!function(){var t=Object.create,e=Object.defineProperty,i=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,s=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=((o,r,c)=>(c=null!=o?t(s(o)):{},((t,s,o,r)=>{if(s&&"object"==typeof s||"function"==typeof s)for(var c,l=n(s),u=0,d=l.length;us[t]).bind(null,c),enumerable:!(r=i(s,c))||r.enumerable});return t})(e(c,"default",{value:o,enumerable:!0}),o)))(((t,e)=>()=>(e||(t((e={exports:{}}).exports,e),t=null),e.exports))((t,e)=>{e.exports=function(t,e,s){"function"==typeof e&&(s=e,e={}),e||(e={});var a,o,r=e.prefix||"__jp",c=e.name||r+i++,l=e.param||"callback",u=null!=e.timeout?e.timeout:6e4,d=encodeURIComponent,h=document.getElementsByTagName("script")[0]||document.head;function g(){a.parentNode&&a.parentNode.removeChild(a),window[c]=n,o&&clearTimeout(o)}return u&&(o=setTimeout(function(){g(),s&&s(new Error("Timeout"))},u)),window[c]=function(t){g(),s&&s(null,t)},t=(t+=(~t.indexOf("?")?"&":"?")+l+"="+d(c)).replace("?&","?"),(a=document.createElement("script")).src=t,h.parentNode.insertBefore(a,h),function(){window[c]&&g()}};var i=0;function n(){}})()),r="Push",c="ChromePush",l="Email",u="SafariPush",d="SafariLegacyPush",h="FirefoxPush",g="chrome",p="edge",f="safari",w="firefox",_=[{t:"Opera",i:/(?:opera|opr|opios)/i,o:/(?:opera|opr|opios)[ /](\d+(?:\.\d+)?)/i},{t:"Facebook",i:/FBAN\//i,o:/FBAV\/(\d+(?:\.\d+)?)/i},{t:"Samsung Browser",i:/samsungbrowser/i,o:/samsungbrowser[ /](\d+(?:\.\d+)?)/i},{t:"Yandex Browser",i:/yabrowser/i,o:/yabrowser[ /](\d+(?:\.\d+)?)/i},{t:"Vivaldi",i:/vivaldi/i,o:/vivaldi[ /](\d+(?:\.\d+)?)/i},{t:"UC Browser",i:/ucbrowser/i,o:/ucbrowser[ /](\d+(?:\.\d+)?)/i},{t:"Microsoft Edge",i:/edg/i,o:/edg[ /](\d+(?:\.\d+)?)/i},{t:"Firefox",i:/firefox|iceweasel|fxios/i,o:/(?:firefox|iceweasel|fxios)[ /](\d+(?:\.\d+)?)/i},{t:"Chromium",i:/chromium/i,o:/chromium[ /](\d+(?:\.\d+)?)/i},{t:"Chrome",i:/chrome|crios|crmo/i,o:/(?:chrome|crios|crmo)[ /](\d+(?:\.\d+)?)/i},{t:"Safari",i:/safari|applewebkit/i,o:/version[ /](\d+(?:\.\d+)?)/i}];function b(t){for(const e of _)if(e.i.test(t)){const i=t.match(e.o)?.[1]??"";return{name:e.t,version:i}}return{name:"Unknown",version:""}}var m=t=>!/like android/i.test(t)&&/android/i.test(t),y=t=>t.match(/(iphone|ipod|ipad)/i)?.[1]?.toLowerCase()||"";function S(t=navigator.userAgent){const e=y(t);return/tablet/i.test(t)&&!/tablet pc/i.test(t)||"ipad"===e||m(t)&&!/[^-]mobi/i.test(t)||!/nexus\s*[0-6]\s*/i.test(t)&&/nexus\s*\d+/i.test(t)}function v(t=navigator.userAgent){if(S(t))return!1;const e=y(t);return/[^-]mobi/i.test(t)||"iphone"===e||"ipod"===e||m(t)}var O={Chrome:g,Chromium:g,Firefox:w,"Microsoft Edge":p,Safari:f};function I(){return O[b(navigator.userAgent).name]||"other"}var k=()=>{const t=b(navigator.userAgent).version;if(!t)return-1;const[e,i="0"]=t.split(".");return+`${e}.${i}`};function x(){const t=I(),e=k();return t===w&&e>=72||t===f&&e>=12.1}var C="160610",E=()=>"undefined"!=typeof window,P=()=>E()&&void 0!==window.safari,$=()=>"undefined"!=typeof navigator&&"serviceWorker"in navigator,T="Browser",N=()=>{if(!E()||null==window.safari?.pushNotification)return!1;const t=OneSignal?.config?.safariWebId;if(!t)return!1;if("undefined"==typeof PushSubscriptionOptions||!PushSubscriptionOptions.prototype.hasOwnProperty("applicationServerKey"))return!0;const{permission:e,deviceToken:i}=window.safari.pushNotification.permission(t);return"granted"===e&&null!=i},A="undefined"!=typeof PushSubscriptionOptions&&PushSubscriptionOptions.prototype.hasOwnProperty("applicationServerKey"),M=({action:t,legacy:e=!1}={})=>new URL(e?"https://onesignal.com/api/v1/":"https://api.onesignal.com/"),U=()=>I()===w?h:I()===f&&A&&!N()?u:N()?d:c;function D(){return String(k())}function L(){return navigator.platform}var F="set-alias",R="delete-alias",W="set-property",B="refresh-user",j="login-user",z="create-subscription",K="update-subscription",V="delete-subscription",q="transfer-subscription",H="custom-event",J="external_id",G="onesignal_id",Y=class extends Error{status;statusText;constructor(t,e){super("Registration of a Service Worker failed."),this.status=t,this.statusText=e}},Q=class extends Error{reason;constructor(t){let e;switch(t){case 1:e="Invalid email";break;case 0:e="Invalid sms";break;case 2:e="Invalid email & sms"}super(e),this.reason=t}},Z=new Error("Missing app ID"),X=new Error("Retry limit reached"),tt=new Error("Permission blocked"),et=new Error("AppID doesn't match existing apps"),it=new Error("Safari web platform must be enabled"),nt=t=>new Error(`Channel '${t}' already exists`),st=t=>new Error(`"${t}" is empty`),at=t=>new Error(`"${t}" is malformed`),ot=t=>new Error(`"${t}" is the wrong type`);function rt(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function ct(t,e){if(e&&e.allowNull&&null===t)return!0;if(e&&e.allowEmpty&&null==t)return!0;try{const i=new URL(t);return!e||!e.requireHttps||"https:"===i.protocol}catch{return!1}}function lt(t){return/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(t)}function ut(t){return new Promise(e=>setTimeout(e,t))}function dt(){return location.origin}var ht=class t{static l(){try{return"trace"===window.localStorage.getItem("loglevel")?.toLowerCase()}catch{return!1}}static u(t){try{window.localStorage.setItem("loglevel",t)}catch(e){console.error(e)}}static h(t){return(...e)=>{(this.l()||"error"===t)&&console[t](...e)}}static p=t.h("debug");static _=t.h("info");static m=t.h("warn");static S=t.h("error")};function gt(t){return encodeURIComponent(t).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function pt(t,e,i){return _t("POST",t,e,i)}function ft(t,e,i){return _t("DELETE",t,e,i)}function wt(t,e,i){return _t("PATCH",t,e,i)}function _t(t,e,i,n){if(a=i,!((s=e).startsWith("apps/")||s.startsWith("sync/")?lt(s.split("/")[1]):a&&"string"==typeof a.app_id&<(a.app_id)))return Promise.reject(Z);var s,a;const o=new Headers;if(o.append("Origin",window.location.origin),o.append("SDK-Version",`onesignal/web/${C}`),o.append("Content-Type","application/json;charset=UTF-8"),o.append("Accept","application/vnd.onesignal.v1+json"),n)for(const l of Object.keys(n))o.append(l,n[l]);const r={method:t||"NO_METHOD_SPECIFIED",headers:o,cache:"no-cache"};i&&(r.body=JSON.stringify(i));const c=e.split("/").map(gt).join("/");return bt(`${M({action:e}).toString()}${c}`,r)}async function bt(t,e,i=5){if(0===i)return Promise.reject(X);try{const i=await fetch(t,e),{status:n,headers:s}=i,a=await i.json(),o=s?.get("Retry-After");return{ok:i.ok,result:a,status:n,retryAfterSeconds:o?parseInt(o):void 0}}catch(n){if(n instanceof Error&&"TypeError"===n.name)return await ut(i>3?1e4*(6-i):3e4),ht.S(`Fetch timeout ${t}, retrying...`),bt(t,e,i-1);throw new Error(`Failed to execute HTTP call: ${String(n)}`)}}async function mt(t,e,i){const{appId:n,subscriptionId:s}=t;if(!lt(n))throw et;const a=s?{"OneSignal-Subscription-Id":s}:void 0;let o={};return a&&(o={...o,...a}),t.jwtHeader&&(o={...o,...t.jwtHeader}),wt(`apps/${n}/users/by/${e.label}/${e.id}`,i,o)}function yt(t){let e="";const i=Object.keys(t);for(const n of i){const i=t[n];e+=`${encodeURIComponent(n)}=${encodeURIComponent(i)}`}return e}async function St(t){ht._("Outcome payload:",t);try{await pt("outcomes/measure",t)}catch(e){ht.S("sendOutcome",e)}}async function vt(t){return await new Promise((e,i)=>{var n,s;n=`${M().toString()}sync/${t}/web`,s=(t,n)=>{t?i(t):n.success?e(n):i(n)},(0,o.default)(n,{prefix:"__jp",name:void 0,param:"callback",timeout:6e4},s)})}var Ot={scope:"/"},It="OneSignalSDKWorker.js",kt="native",xt="push",Ct="category",Et="sms",Pt="email",$t="smsAndEmail",Tt={pageViews:1,timeDelay:0},Nt="We'd like to show you notifications for the latest news and updates.",At="Allow",Mt="Cancel",Ut="Try Again",Dt="Update your push notification subscription preferences.",Lt="Save Preferences",Ft="Cancel",Rt={type:xt,text:{actionMessage:Nt,acceptButton:At,cancelButton:Mt},autoPrompt:!1,delay:Tt},Wt="custom";function Bt(t){const e=t.config.staticPrompts,i=e.native?{enabled:e.native.enabled,autoPrompt:e.native.enabled&&!1!==e.native.autoPrompt,pageViews:e.native.pageViews??Tt.pageViews,timeDelay:e.native.timeDelay??Tt.timeDelay}:{enabled:!1,autoPrompt:!1,pageViews:Tt.pageViews,timeDelay:Tt.timeDelay},{prompts:n}=e.slidedown;return{autoPrompt:i.autoPrompt||jt(n),native:i,slidedown:{prompts:n},fullscreen:{enabled:e.fullscreen.enabled,actionMessage:e.fullscreen.actionMessage,acceptButton:e.fullscreen.acceptButton,cancelButton:e.fullscreen.cancelButton,title:e.fullscreen.title,message:e.fullscreen.message,caption:e.fullscreen.caption,autoAcceptTitle:e.fullscreen.autoAcceptTitle},customlink:zt(t)}}function jt(t){if(!t)return!1;for(let e=0;e{if(t.type=t.type??xt,t.type===Ct&&(t.text={...t.text,positiveUpdateButton:t.text?.positiveUpdateButton??Lt,negativeUpdateButton:t.text?.negativeUpdateButton??Ft,updateMessage:t.text?.updateMessage??Dt}),t.text={...t.text,actionMessage:t.text?.actionMessage??Nt,acceptButton:t.text?.acceptButton??At,cancelButton:t.text?.cancelButton??Mt,confirmMessage:t.text?.confirmMessage??"Thank You!"},t.autoPrompt=t.autoPrompt??!0,t.delay={pageViews:t.delay?.pageViews??Tt.pageViews,timeDelay:t.delay?.timeDelay??Tt.timeDelay},t.categories){const{categories:e}=t;t.categories=structuredClone(e).slice(0,10)}return t}):(a.slidedown={prompts:[]},a.slidedown.prompts=[Rt]),a.native){const t=Object.prototype.hasOwnProperty.call(a.native,"autoPrompt");a.native.autoPrompt=t?!!a.native.enabled&&!!a.native.autoPrompt:!!a.native.enabled,a.native.enabled=!!a.native.enabled,a.native.pageViews=a.native.pageViews??Tt.pageViews,a.native.timeDelay=a.native.timeDelay??Tt.timeDelay}else a.native={enabled:!1,autoPrompt:!1,pageViews:Tt.pageViews,timeDelay:Tt.timeDelay};return!0===i.autoRegister&&(a.native.enabled=!0,a.native.autoPrompt=!0),a.autoPrompt=a.native.autoPrompt||jt(a.slidedown.prompts),a}async function qt(t){return async function(t,e){try{if(!t||!t.appId||!lt(t.appId))throw et;const i=await e(t.appId);!function(t){var e;(e=t.promptOptions)&&["acceptButtonText","cancelButtonText","actionMessage"].some(t=>Object.prototype.hasOwnProperty.call(e,t))&&(t.promptOptions=function(t){t.slidedown||(t.slidedown={});const{slidedown:e}=t;return e.acceptButtonText=e.acceptButtonText??t.acceptButtonText??t.acceptButton,e.cancelButtonText=e.cancelButtonText??t.cancelButtonText??t.cancelButton,e.actionMessage=e.actionMessage??t.actionMessage,t}(t.promptOptions)),function(t){return!!t&&["enabled","autoPrompt","pageViews","timeDelay","acceptButton","acceptButtonText","cancelButton","cancelButtonText","actionMessage","customizeTextEnabled","categories"].some(e=>Object.prototype.hasOwnProperty.call(t,e))}(t.promptOptions?.slidedown)&&t.promptOptions?.slidedown&&(t.promptOptions.slidedown=function(t){const e=(a=t,(a?.categories?.tags?.length||0)>0),i=e?Ct:xt,{categories:n,prompts:s=[]}=t;var a;return{prompts:[...s,{type:i,autoPrompt:t.autoPrompt,text:{actionMessage:t.actionMessage,acceptButton:t.acceptButton??t.acceptButtonText,cancelButton:t.cancelButton??t.cancelButtonText,...e&&{positiveUpdateButton:n?.positiveUpdateButton,negativeUpdateButton:n?.negativeUpdateButton,updateMessage:n?.updateMessage}},delay:{pageViews:t.pageViews,timeDelay:t.timeDelay},categories:n?.tags}]}}(t.promptOptions?.slidedown))}(t);const n=function(t,e){const i=function(t){return t.config.integration?.kind??Wt}(e),n=function(t,e,i){switch(Kt(t).configuration){case 0:return i.config.siteInfo.proxyOriginEnabled;case 1:return!!e.subdomainName}}(i,t,e),s=function(t,e,i){switch(Kt(t).configuration){case 0:{const{path:t,serviceWorkerPath:n,serviceWorkerParam:s}=function(t,e){const{serviceWorker:i}=e.config,n=t.serviceWorkerOverrideForTypical;return{path:n?t.path??i.path:i.path,serviceWorkerParam:n?t.serviceWorkerParam??{scope:i.registrationScope}:{scope:i.registrationScope},serviceWorkerPath:n?t.serviceWorkerPath??i.workerName:i.workerName}}(e,i);return{appId:i.app_id,autoRegister:!1,autoResubscribe:i.config.autoResubscribe,path:t,serviceWorkerPath:n,serviceWorkerParam:s,subdomainName:i.config.siteInfo.proxyOrigin,promptOptions:Bt(i),welcomeNotification:{disable:!i.config.welcomeNotification.enable,title:i.config.welcomeNotification.title,message:i.config.welcomeNotification.message,url:i.config.welcomeNotification.url},notifyButton:{enable:i.config.staticPrompts.bell.enabled,displayPredicate:i.config.staticPrompts.bell.hideWhenSubscribed?()=>!OneSignal.User.PushSubscription.optedIn:null,size:i.config.staticPrompts.bell.size,position:i.config.staticPrompts.bell.location,showCredit:!1,offset:{bottom:`${i.config.staticPrompts.bell.offset.bottom}px`,left:`${i.config.staticPrompts.bell.offset.left}px`,right:`${i.config.staticPrompts.bell.offset.right}px`},colors:{"circle.background":i.config.staticPrompts.bell.color.main,"circle.foreground":i.config.staticPrompts.bell.color.accent,"badge.background":"black","badge.foreground":"white","badge.bordercolor":"black","pulse.color":i.config.staticPrompts.bell.color.accent,"dialog.button.background.hovering":i.config.staticPrompts.bell.color.main,"dialog.button.background.active":i.config.staticPrompts.bell.color.main,"dialog.button.background":i.config.staticPrompts.bell.color.main,"dialog.button.foreground":"white"},text:{"tip.state.unsubscribed":i.config.staticPrompts.bell.tooltip.unsubscribed,"tip.state.subscribed":i.config.staticPrompts.bell.tooltip.subscribed,"tip.state.blocked":i.config.staticPrompts.bell.tooltip.blocked,"message.prenotify":i.config.staticPrompts.bell.tooltip.unsubscribed,"message.action.subscribing":i.config.staticPrompts.bell.message.subscribing,"message.action.subscribed":i.config.staticPrompts.bell.message.subscribing,"message.action.resubscribed":i.config.staticPrompts.bell.message.subscribing,"message.action.unsubscribed":i.config.staticPrompts.bell.message.unsubscribing,"dialog.main.title":i.config.staticPrompts.bell.dialog.main.title,"dialog.main.button.subscribe":i.config.staticPrompts.bell.dialog.main.subscribeButton,"dialog.main.button.unsubscribe":i.config.staticPrompts.bell.dialog.main.unsubscribeButton,"dialog.blocked.title":i.config.staticPrompts.bell.dialog.blocked.title,"dialog.blocked.message":i.config.staticPrompts.bell.dialog.blocked.message}},persistNotification:i.config.notificationBehavior?i.config.notificationBehavior.display.persist:void 0,webhooks:{cors:i.config.webhooks.corsEnable,"notification.willDisplay":i.config.webhooks.notificationDisplayedHook,"notification.clicked":i.config.webhooks.notificationClickedHook,"notification.dismissed":i.config.webhooks.notificationDismissedHook},notificationClickHandlerMatch:i.config.notificationBehavior?i.config.notificationBehavior.click.match:void 0,notificationClickHandlerAction:i.config.notificationBehavior?i.config.notificationBehavior.click.action:void 0,outcomes:{direct:i.config.outcomes.direct,indirect:{enabled:i.config.outcomes.indirect.enabled,influencedTimePeriodMin:i.config.outcomes.indirect.notification_attribution.minutes_since_displayed,influencedNotificationsLimit:i.config.outcomes.indirect.notification_attribution.limit},unattributed:i.config.outcomes.unattributed}}}case 1:{const t={...e,promptOptions:Vt(e.promptOptions,i.config.staticPrompts,e),serviceWorkerParam:e.serviceWorkerParam?e.serviceWorkerParam:Ot,serviceWorkerPath:e.serviceWorkerPath?e.serviceWorkerPath:It,path:e.path?e.path:"/",outcomes:{direct:i.config.outcomes.direct,indirect:{enabled:i.config.outcomes.indirect.enabled,influencedTimePeriodMin:i.config.outcomes.indirect.notification_attribution.minutes_since_displayed,influencedNotificationsLimit:i.config.outcomes.indirect.notification_attribution.limit},unattributed:i.config.outcomes.unattributed}};return Object.prototype.hasOwnProperty.call(e,"autoResubscribe")?t.autoResubscribe=!!e.autoResubscribe:Object.prototype.hasOwnProperty.call(e,"autoRegister")?t.autoResubscribe=!!e.autoRegister:t.autoResubscribe=!!i.config.autoResubscribe,t}}}(i,t,e);return{appId:e.app_id,hasUnsupportedSubdomain:n,siteName:e.config.siteInfo.name,origin:e.config.origin,restrictedOriginEnabled:e.features.restrict_origin&&e.features.restrict_origin.enable,safariWebId:e.config.safari_web_id,vapidPublicKey:e.config.vapid_public_key,onesignalVapidPublicKey:e.config.onesignal_vapid_public_key,userConfig:s,enableOnSession:e.features.enable_on_session??false,sessionThreshold:e.features.session_threshold??30,enableSessionDuration:e.features.web_on_focus_enabled??true}}(t,i);return function(t){const e=!self.isSecureContext;if(t.hasUnsupportedSubdomain||e)throw e?new Error("OneSignalSDK: HTTP sites are no longer supported starting with version 16 (User Model), your public site must start with https://."):new Error('OneSignalSDK: The "My site is not fully HTTPS" option is no longer supported starting with version 16 (User Model) of the OneSignal SDK.')}(n),function(t){if(t.restrictedOriginEnabled&&!function(t){try{return location.origin===new URL(t).origin}catch{return!1}}(t.origin))throw new Error(`Can only be used on: ${new URL(t.origin).origin}`)}(n),n}catch(i){if(i instanceof Object&&"code"in i){if(1===i.code)throw et;if(2===i.code)throw new Error("App not configured for web push")}throw i}}(t,vt)}function Ht(t){return new Promise((e,i)=>{t.onsuccess=()=>e(t.result),t.onerror=()=>i(t.error)})}var Jt=!1,Gt=async(t=7)=>function(t){const e=(e,i)=>t.transaction(e,i).objectStore(e);return{get:async(t,i)=>Ht(e(t).get(i)),getAll:async t=>Ht(e(t).getAll()),put:async(t,i)=>Ht(e(t,"readwrite").put(i)),delete:async(t,i)=>Ht(e(t,"readwrite").delete(i)),clear:async t=>Ht(e(t,"readwrite").clear()),close:()=>t.close(),get objectStoreNames(){return t.objectStoreNames}}}(await function(t,e,i){return new Promise((t,n)=>{const s=indexedDB.open("ONE_SIGNAL_SDK_DB",e);s.onupgradeneeded=t=>i?.upgrade?.(s.result,t.oldVersion,t.newVersion,s.transaction),s.onsuccess=()=>{i?.terminated&&(s.result.onclose=i.terminated),t(s.result)},s.onerror=()=>n(s.error),s.onblocked=()=>i?.blocked?.()})}(0,t,{upgrade(e,i,n,s){const a=n||t;a>=1&&i<1&&(e.createObjectStore("Ids",{keyPath:"type"}),e.createObjectStore("NotificationOpened",{keyPath:"url"}),e.createObjectStore("Options",{keyPath:"key"})),a>=2&&i<2&&(e.createObjectStore("Sessions",{keyPath:"sessionKey"}),e.createObjectStore("NotificationReceived",{keyPath:"notificationId"}),e.createObjectStore("NotificationClicked",{keyPath:"notificationId"})),a>=3&&i<3&&e.createObjectStore("SentUniqueOutcome",{keyPath:"outcomeName"}),a>=4&&i<4&&(e.createObjectStore("identity",{keyPath:"modelId"}),e.createObjectStore("properties",{keyPath:"modelId"}),e.createObjectStore("pushSubscriptions",{keyPath:"modelId"}),e.createObjectStore("smsSubscriptions",{keyPath:"modelId"}),e.createObjectStore("emailSubscriptions",{keyPath:"modelId"})),a>=5&&i<5&&(async function(t,e){const i="NotificationClicked",n="Outcomes.NotificationClicked";t.createObjectStore(n,{keyPath:"notificationId"});const s=await Ht(e.objectStore(i).getAll()),a=e.objectStore(n);for(const o of s)a.put({notificationId:o.notificationId||o.notification.id,appId:o.appId,timestamp:o.timestamp});t.deleteObjectStore(i)}(e,s),async function(t,e){const i="NotificationReceived",n="Outcomes.NotificationReceived";t.createObjectStore(n,{keyPath:"notificationId"});const s=await Ht(e.objectStore(i).getAll()),a=e.objectStore(n);for(const o of s)a.put(o);t.deleteObjectStore(i)}(e,s)),a>=6&&i<6&&async function(t,e){const i="subscriptions";let n;t.createObjectStore(i,{keyPath:"modelId"});const s=await Ht(e.objectStore("identity").getAll());s.length>0&&(n=s[0].externalId);for(const a of["emailSubscriptions","pushSubscriptions","smsSubscriptions"]){const s=await Ht(e.objectStore(a).getAll()),o=e.objectStore(i);for(const t of s)o.put({...t,modelName:"subscriptions",externalId:n});t.deleteObjectStore(a)}}(e,s),a>=7&&i<7&&e.createObjectStore("operations",{keyPath:"modelId"}),Jt=!1,"undefined"!=typeof OneSignal&&(OneSignal.v=!0)},blocked(){ht.p("IndexedDB: Blocked event")},terminated(){Jt||(Jt=!0,Qt())}})),Yt=Gt(),Qt=(t=7)=>Yt=Gt(t),Zt=!1;function Xt(t,e,i){if(Zt)return Promise.resolve(i);let n;const s=new Promise(e=>{n=setTimeout(()=>{Zt=!0,ht.m(`db.${t} timed out`),e(i)},1500)});return Promise.race([e(),s]).finally(()=>clearTimeout(n))}var te={async get(t,e){const i=await Yt;return Xt(`get(${t})`,()=>i.get(t,e),void 0)},async getAll(t){const e=await Yt;return Xt(`getAll(${t})`,()=>e.getAll(t),[])},async put(t,e){const i=await Yt;return Xt(`put(${t})`,()=>i.put(t,e),void 0)},async delete(t,e){const i=await Yt;return Xt(`delete(${t}/${e})`,()=>i.delete(t,e),void 0)}},ee=async t=>{const e=await te.get("Options",t);return e&&"value"in e?e.value:null},ie=async t=>{const e=await te.get("Ids",t);return e&&"id"in e?e.id:null},ne=async()=>await te.get("Sessions","oneSignalSession")??null,se="os_pageViews",ae="requiresPrivacyConsent",oe="userConsent";function re(){const t=OneSignal.config?.userConfig.requiresUserPrivacyConsent??!1;return"true"===localStorage.getItem(ae)||t}function ce(t){localStorage.setItem(oe,t.toString())}function le(){return Number(localStorage.getItem(se))}var ue=async()=>{const t={};return t.appId=await ie("appId"),t.vapidPublicKey=await ee("vapidPublicKey"),t},de=async()=>{const t=await ee("defaultUrl"),e=await ee("defaultTitle"),i=await ee("isPushEnabled"),n=await ee("lastOptedIn");return{defaultNotificationUrl:t,defaultNotificationTitle:e,lastKnownPushEnabled:i,lastKnownPushId:await ee("lastPushId")??void 0,lastKnownPushToken:await ee("lastPushToken")??void 0,lastKnownOptedIn:n}},he=async t=>{t.defaultNotificationUrl&&await te.put("Options",{key:"defaultUrl",value:t.defaultNotificationUrl}),(t.defaultNotificationTitle||""===t.defaultNotificationTitle)&&await te.put("Options",{key:"defaultTitle",value:t.defaultNotificationTitle}),null!=t.lastKnownPushEnabled&&await te.put("Options",{key:"isPushEnabled",value:t.lastKnownPushEnabled}),null!=t.lastKnownPushId&&await te.put("Options",{key:"lastPushId",value:t.lastKnownPushId}),null!=t.lastKnownPushToken&&await te.put("Options",{key:"lastPushToken",value:t.lastKnownPushToken}),null!=t.lastKnownOptedIn&&await te.put("Options",{key:"lastOptedIn",value:t.lastKnownOptedIn})},ge=()=>{const t=re(),e=OneSignal.O,i=t&&!e;return i&&ht.m("Consent required but not given"),i},pe=class t{deviceId;subscriptionToken;optedOut;createdAt;expirationTime;I(){return{deviceId:this.deviceId,subscriptionToken:this.subscriptionToken,optedOut:this.optedOut,createdAt:this.createdAt,expirationTime:this.expirationTime}}static k(e){const i=new t;return i.deviceId=e.deviceId,i.subscriptionToken=e.subscriptionToken,i.optedOut=e.optedOut,i.createdAt=e.createdAt,i.expirationTime=e.expirationTime,i}},fe=async()=>{const t=new pe;t.deviceId=(await te.get("Ids","userId"))?.id,t.subscriptionToken=(await te.get("Ids","registrationId"))?.id;const e=await ee("optedOut"),i=await ee("subscription"),n=await ee("subscriptionCreatedAt"),s=await ee("subscriptionExpirationTime");return t.optedOut=null!=e?e:null!=i&&!i,t.createdAt=n??null,t.expirationTime=s??null,t},we=async t=>{t.deviceId&&await te.put("Ids",{type:"userId",id:t.deviceId}),void 0!==t.subscriptionToken&&await te.put("Ids",{type:"registrationId",id:t.subscriptionToken}),null!=t.optedOut&&await te.put("Options",{key:"optedOut",value:t.optedOut}),null!=t.createdAt&&await te.put("Options",{key:"subscriptionCreatedAt",value:t.createdAt}),null!=t.expirationTime?await te.put("Options",{key:"subscriptionExpirationTime",value:t.expirationTime}):await te.delete("Options","subscriptionExpirationTime")};function _e(t){if("string"==typeof t){const e=document.querySelector(t);if(!e)throw new Error(`Cannot find element with selector "${t}"`);return e}return t}function be(t,e,i){_e(t).insertAdjacentHTML(e,i)}function me(t){for(const e of document.querySelectorAll(t))e.remove()}function ye(t){return document.querySelector(t)??document.createElement("div")}function Se(t,e){_e(t).classList.add(e)}function ve(t,e){_e(t).classList.remove(e)}function Oe(t){return"undefined"==typeof DOMParser?t:(new DOMParser).parseFromString(t,"text/html").documentElement.textContent||""}function Ie(){try{return"undefined"!=typeof localStorage&&(localStorage.getItem("test"),!0)}catch{return!1}}function ke(t){if(!Ie())return null;const e=localStorage.getItem(t);let i;try{i=JSON.parse(e)}catch{return null}if(null===i)return null;if(i.timestamp&&(new Date).getTime()>=i.timestamp)return localStorage.removeItem(t),null;let n=i.value;try{n=JSON.parse(i.value)}catch{return n}return n}var xe=0,Ce=1,Ee="onesignal-notification-prompt",Pe="onesignal-non-push-prompt",$e={[xe]:"promptDismissCount",[Ce]:"nonPushPromptsDismissCount"},Te={[xe]:Ee,[Ce]:Pe};async function Ne(t){const e=$e[t],i=Te[t];let n=await ee(e);n||(n=0),n+=1;let s=3;return 2==n?s=7:n>2&&(s=30),ht.p(`Prompt dismissed (${t}), reprompt in ${s}d`),await te.put("Options",{key:e,value:n}),function(t,e,i){if(!Ie())return;const n=void 0!==i?60*i*1e3:0,s={value:JSON.stringify("dismissed"),timestamp:void 0!==i?(new Date).getTime()+n:void 0};localStorage.setItem(t,JSON.stringify(s))}(i,0,24*s*60)}function Ae(t){switch(t){case 0:return"dismissed"===ke(Ee);case 1:return"dismissed"===ke(Pe)}return!1}async function Me(){return new Promise(t=>{OneSignal.C?t():OneSignal.P.once(OneSignal.EVENTS.SDK_INITIALIZED,t)})}function Ue(t,...e){return ht.p(`${t}(${e.map(t=>JSON.stringify(t)).join(", ")})`)}function De(t,e,i,n=!1){if(e||ht.S("on() missing event:",e),i||ht.S("on() missing task:",i),"string"==typeof t){const n=document.querySelectorAll(t);if(n.length>0)for(let t=0;t{if(!We){We=!0;try{await je(t)}finally{We=!1}}},je=async t=>{const e=await OneSignal.M.A.N(),i=await ee("notificationPermission");(e!==i||t)&&(await te.put("Options",{key:"notificationPermission",value:e}),Re.$(OneSignal.EVENTS.NOTIFICATION_PERMISSION_CHANGED_AS_STRING,e),ze(i,e,t))},ze=(t,e,i)=>{const n="granted"===e;(e!==t||i)&&Re.$(OneSignal.EVENTS.NOTIFICATION_PERMISSION_CHANGED_AS_BOOLEAN,n)};async function Ke(){const t=Ve();if(!t)throw Z;const e=`${M().toString()}apps/${t}/icon`,i=await(await fetch(e)).json();if(i.errors)throw ht.S(`API ${e} failed:`,i.errors),new Error("Failed to get notification icons.");return i}function Ve(){return OneSignal.config?.appId||""}async function qe(){if(N())return(window.safari?.pushNotification?.permission(OneSignal.config?.safariWebId).deviceToken)?.toLowerCase()||void 0;const t=await OneSignal.M.D.U();return t?(await t.pushManager.getSubscription())?.endpoint:void 0}var He=class t{L;constructor(){this.L={}}F(){return{...this.L}}async R(){const t=(()=>{let t;return t="https://onesignal.com",new URL("https://onesignal.com/sdks/web/v16")})();return this.W(0,new URL(`${t}/OneSignalSDK.page.styles.css?v=${C}`))}async W(e,i){return this.L[i.toString()]||(this.L[i.toString()]=t.B(e,i)),this.L[i.toString()]}static async B(t,e){try{let i;return await new Promise((n,s)=>{switch(t){case 1:i=document.createElement("script"),i.setAttribute("type","text/javascript"),i.setAttribute("async","async"),i.setAttribute("src",e.toString());break;case 0:i=document.createElement("link"),i.setAttribute("rel","stylesheet"),i.setAttribute("href",e.toString())}i.onerror=s,i.onload=n,document.querySelector("head")?.appendChild(i)}),0}catch{return 1}}},Je=class{j=".onesignal-bell-launcher-badge";get K(){return document.querySelector(this.j)}get V(){return this.K?.textContent??""}set V(t){const e=this.K;e&&(e.textContent=t)}get q(){return this.K?.classList.contains("onesignal-bell-launcher-badge-opened")??!1}H(){const t=this.K;t&&!this.q&&t.classList.add("onesignal-bell-launcher-badge-opened")}J(){const t=this.K;t&&this.q&&t.classList.remove("onesignal-bell-launcher-badge-opened")}G(t){const e=(Number(this.V)||0)+t;this.V=e>0?e.toString():""}Y(){this.G(1)}Z(){this.G(-1)}},Ge={};function Ye(t,e){return void 0===Ge[t]&&(Ge[t]=[null,null]),Ge[t].push(e),3===Ge[t].length&&Ge[t].shift(),Ge[t]}var Qe=0,Ze=1,Xe=2,ti=3,ei="message",ii=2500,ni=class{X;j=".onesignal-bell-launcher-button";constructor(t){this.X=t,this.K?.addEventListener("click",()=>this.tt())}get K(){return document.querySelector(this.j)}tt(){const t=this.K;t&&(t.classList.remove("pulsing"),t.offsetWidth,t.classList.add("pulsing"));const e=function(t){return void 0===Ge[t]&&(Ge[t]=[null,null]),Ge[t]}("subscription.optedOut")[1];this.X.et&&!e&&(Ln(),this.X.it=!0,OneSignal.P.once(OneSignal.EVENTS.SUBSCRIPTION_CHANGED,async()=>{this.X.nt=!0,await this.X.ot.st(ei,this.X.rt.text["message.action.subscribed"],ii),this.X.it=!1,this.X.nt=!1}))}},si="subscribe-button",ai="unsubscribe-button",oi={[g]:"/bell/chrome-unblock.jpg",[w]:"/bell/firefox-unblock.jpg",[f]:"/bell/safari-unblock.jpg",[p]:"/bell/edge-unblock.png"},ri=class{X;ct=null;j=".onesignal-bell-launcher-dialog";constructor(t){this.X=t}get K(){return document.querySelector(this.j)}get q(){return this.K?.matches(":popover-open")??!1}get lt(){return this.K?.querySelector(`#${si}`)??null}get ut(){return this.K?.querySelector(`#${ai}`)??null}J(){const t=this.K;t&&this.q&&t.hidePopover()}async dt(){const t=await OneSignal.M.gt.ht(),e=function(){const t=_e(".onesignal-bell-launcher-dialog-body");return t.replaceChildren(),t}(),i=this.X.rt.text,n=this.X.ft;1===n&&t||2===n&&!t?this.wt(e,i):3===n&&this._t(e,i),this.X.rt.showCredit&&be(e,"beforeend",'
Powered by OneSignal
'),this.lt?.addEventListener("click",()=>{OneSignal.bt=!1,this.X.yt()}),this.ut?.addEventListener("click",()=>this.X.St())}wt(t,e){const i=Fe(this.ct),n="default-icon"!==i?'
':'
',s=1===this.X.ft,a=s?ai:si,o=s?e["dialog.main.button.unsubscribe"]:e["dialog.main.button.subscribe"];be(t,"beforeend",`

${n}
`),t.querySelector("h1").textContent=Oe(e["dialog.main.title"]),t.querySelector(`#${a}`).textContent=Oe(o),"default-icon"!==i&&t.querySelector(".push-notification-icon img").setAttribute("src",i)}_t(t,e){const i=I();let n="";if((v()||S())&&i===g)n="
  1. Access Settings by tapping the three menu dots ⋮
  2. Click Site settings under Advanced.
  3. Click Notifications.
  4. Find and click this entry for this website.
  5. Click Notifications and set it to Allow.
";else{const t=oi[i];if(t){const e="https://media.onesignal.com/web-sdk"+t;n=`Unblock notifications`}}be(t,"beforeend",`

${n}
`),t.querySelector("h1").textContent=Oe(e["dialog.blocked.title"]),t.querySelector(".instructions p").textContent=Oe(e["dialog.blocked.message"])}},ci={small:32,medium:48,large:64},li=class{X;j=".onesignal-bell-launcher";constructor(t){this.X=t}get K(){return document.querySelector(this.j)}get q(){return this.K?.classList.contains("onesignal-bell-launcher-active")??!1}H(){const t=this.K;t&&!this.q&&t.classList.add("onesignal-bell-launcher-active")}J(){const t=this.K;t&&this.q&&(this.X.vt.J(),t.classList.remove("onesignal-bell-launcher-active"))}Ot(t){const e=this.K;if(!e)throw new Error("Missing DOM element");const i=ci[t];if(!i)throw new Error("Invalid OneSignal bell size "+t);e.style.setProperty("--bell-size",`${i}px`),e.style.setProperty("--bell-resting-scale",""+32/i),e.style.setProperty("--badge-font-size",i<=32?"8px":"12px")}},ui={[Xe]:"tip.state.unsubscribed",[Ze]:"tip.state.subscribed",[ti]:"tip.state.blocked",[Qe]:""},di=class{X;It="";j=".onesignal-bell-launcher-message";constructor(t){this.X=t}get K(){return document.querySelector(this.j)}get V(){return this.K?.querySelector(".onesignal-bell-launcher-message-body")?.textContent??""}set V(t){const e=this.K?.querySelector(".onesignal-bell-launcher-message-body");e&&(e.textContent=t)}get q(){return this.K?.classList.contains("onesignal-bell-launcher-message-opened")??!1}H(){const t=this.K;t&&!this.q&&t.classList.add("onesignal-bell-launcher-message-opened")}J(){const t=this.K;t&&this.q&&t.classList.remove("onesignal-bell-launcher-message-opened")}async st(t,e,i=0){ht.p("display:",t,e,i),this.q&&this.J(),this.V=Oe(e),this.It=t,this.H(),await ut(i),this.J(),this.V=this.kt(),this.It="tip"}kt(){const t=ui[this.X.ft];return t?this.X.rt.text[t]??"":""}},hi="medium",gi=["small","medium","large"],pi=["bottom-left","bottom-right"],fi=["default","inverse"],wi="Manage notifications",_i={"launcher.button.aria-label":wi,"tip.state.unsubscribed":"Subscribe to notifications","tip.state.subscribed":"You're subscribed to notifications","tip.state.blocked":"You've blocked notifications","message.prenotify":"Click to subscribe to notifications","message.action.subscribed":"Thanks for subscribing!","message.action.resubscribed":"You're subscribed to notifications","message.action.subscribing":"Click {{prompt.native.grant}} to receive notifications","message.action.unsubscribed":"You won't receive notifications again","dialog.main.title":"Manage Site Notifications","dialog.main.button.subscribe":"SUBSCRIBE","dialog.main.button.unsubscribe":"UNSUBSCRIBE","dialog.blocked.title":"Unblock Notifications","dialog.blocked.message":"Follow these instructions to allow notifications:"},bi=class{rt;ft=0;it=!1;nt=!1;C=!1;xt;Ct;Et;Pt;$t;constructor(t,e){this.rt={enable:t.enable||!1,size:t.size||hi,position:t.position||"bottom-right",theme:t.theme||"default",showLauncherAfter:t.showLauncherAfter||10,showBadgeAfter:t.showBadgeAfter||300,text:{..._i,...t.text},prenotify:t.prenotify,showCredit:t.showCredit,colors:t.colors,offset:t.offset},e&&(this.xt=e),this.rt.enable&&(this.Tt(this.rt),this.Nt())}Tt(t){const e=(t,e,i)=>{if(!t||!e.includes(t))throw new Error(`Invalid ${i} '${t}'. Choose: ${e.join(", ")}`)},i=(t,e)=>{if(!t||t<0)throw new Error(`Invalid ${e}. Must be above 0.`)};e(t.size,gi,"size"),e(t.position,pi,"position"),e(t.theme,fi,"theme"),i(t.showLauncherAfter,"showLauncherAfter"),i(t.showBadgeAfter,"showBadgeAfter")}Nt(){OneSignal.P.on(OneSignal.EVENTS.SUBSCRIPTION_CHANGED,async t=>{t.current.optedIn&&(this.At.q&&this.rt.prenotify&&this.At.J(),null===this.vt.ct&&(this.vt.ct=await Ke()),this.nt||this.vt.J());const e=await OneSignal.M.A.N(),i=t.current.optedIn?1:"denied"===e?3:2;this.Mt(i,this.it)}),OneSignal.P.on(OneSignal.EVENTS.NOTIFICATION_PERMISSION_CHANGED_AS_STRING,()=>this.Ut())}async yt(){const t=this.vt.lt;t&&(t.disabled=!0),this.it=!0,this.nt=!0,await OneSignal.User.PushSubscription.optIn(),t&&(t.disabled=!1),this.vt.J(),await this.ot.st(ei,this.rt.text["message.action.resubscribed"],ii),this.it=!1,this.nt=!1,this.Ut()}async St(){const t=this.vt.ut;t&&(t.disabled=!0),this.nt=!0,await OneSignal.User.PushSubscription.optOut(),t&&(t.disabled=!1),this.vt.J(),await this.ot.st(ei,this.rt.text["message.action.unsubscribed"],ii),this.nt=!1,this.Ut()}Dt(){const{position:t,theme:e}=this.rt,i=this.Lt;i&&Se(i,`onesignal-bell-container-${t}`),Se(this.Ft.j,`onesignal-bell-launcher-${t}`),Se(this.Ft.j,`onesignal-bell-launcher-theme-${e}`)}async Rt(){if(!this.rt.enable)return;if(!CSS.supports("anchor-name: --a"))return void ht.S("Bell requires CSS Anchor Positioning");if(0!==await OneSignal.M.Wt.R())return void ht.p("Bell styles failed to load");this.Lt&&me("#onesignal-bell-container"),be("body","beforeend",'
'),this.Lt&&be(this.Lt,"beforeend",'
'),be(this.Ft.j,"beforeend",''),this.Bt.K?.setAttribute("aria-label",this.rt.text["launcher.button.aria-label"]||wi),be(this.Ft.j,"beforeend",'
'),be(this.Ft.j,"beforeend",'
'),be(this.ot.j,"beforeend",'
'),be(this.Ft.j,"beforeend",'
'),be(this.vt.j,"beforeend",'
'),be(this.Bt.j,"beforeend",''),this.Ft.K?.addEventListener("mouseleave",()=>{this.Bt.K?.blur()});const t=this.vt.K;t&&(t.addEventListener("toggle",t=>{"open"===t.newState&&(this.vt.dt(),this.ot.J())}),t.addEventListener("beforetoggle",t=>{"open"===t.newState&&this.ot.q&&this.ot.It===ei&&t.preventDefault()}));const e=await OneSignal.M.gt.ht();Ae(0),this.Ft.Ot(this.rt.size||hi),this.Dt(),this.jt(),this.zt(),ht._("Showing bell"),e&&null===this.vt.ct&&(this.vt.ct=await Ke()),await ut(this.rt.showLauncherAfter||0),this.Ft.H(),await this.Ut(),await ut(this.rt.showBadgeAfter||0),this.rt.prenotify&&!e&&!this.Kt&&OneSignal.v&&(this.ot.V=Oe(this.rt.text["message.prenotify"]),this.At.Y(),this.At.H()),this.C=!0}jt(){const t=this.rt.offset;if(!t)return;const e=this.Ft.K;if(!e)return void ht.S("Bell element not found");t.bottom&&(e.style.bottom=t.bottom);const i="bottom-right"===this.rt.position?t.right:t.left;i&&(e.style["bottom-right"===this.rt.position?"right":"left"]=i)}zt(){const t=this.rt.colors;if(!t)return;const e=this.Ft.K;if(!e)return;const i=(t,i)=>{i&&e.style.setProperty(t,i)};i("--bell-bg",t["circle.background"]),i("--bell-fg",t["circle.foreground"]),i("--badge-bg",t["badge.background"]),i("--badge-border",t["badge.bordercolor"]),i("--badge-fg",t["badge.foreground"]),i("--btn-bg",t["dialog.button.background"]),i("--btn-fg",t["dialog.button.foreground"]),i("--btn-hover-bg",t["dialog.button.background.hovering"]),i("--btn-active-bg",t["dialog.button.background.active"]),i("--pulse-color",t["pulse.color"])}async Ut(){try{const[t,e]=await Promise.all([OneSignal.M.gt.ht(),OneSignal.M.A.N()]),i="denied"===e?3:t?1:2;this.Mt(i)}catch(t){ht.S(t)}}Mt(t,e=!1){const i=this.ft;this.ft=t,i===t||e||this.Ft.K&&(this.ot.V=Oe(this.ot.kt()))}get Lt(){return document.querySelector("#onesignal-bell-container")}get Ft(){return this.xt||(this.xt=new li(this)),this.xt}get Bt(){return this.Ct||(this.Ct=new ni(this)),this.Ct}get At(){return this.Et||(this.Et=new Je),this.Et}get ot(){return this.Pt||(this.Pt=new di(this)),this.Pt}get vt(){return this.$t||(this.$t=new ri(this)),this.$t}get Vt(){return 1===this.ft}get et(){return 2===this.ft}get Kt(){return 3===this.ft}},mi="onesignal-button-indicator-holder",yi="onesignal-slidedown-container",Si="onesignal-slidedown-dialog",vi="onesignal-reset",Oi="onesignal-saving-state-button",Ii="slide-up",ki="slide-down",xi="close-slidedown",Ci="default-icon",Ei="clearfix",Pi="onesignal-slidedown-allow-button",$i="slidedown-body",Ti="onesignal-button-indicator-holder",Ni="onesignal-slidedown-cancel-button",Ai="onesignal-slidedown-container",Mi="onesignal-slidedown-dialog",Ui="slidedown-footer",Di="onesignal-loading-container",Li="align-right",Fi="slidedown-button",Ri="tagging-container",Wi="tagging-container-col",Bi="channel-capture-container",ji="onesignal-error-input",zi="onesignal-validation-element-hidden",Ki="sms-input-with-validation-element",Vi="email-input-with-validation-element",qi="iti-onesignal-sms-input",Hi="onesignal-email-input",Ji="onesignal-sms-validation-element",Gi="onesignal-email-validation-element",Yi="onesignal-customlink-subscribe",Qi="onesignal-customlink-explanation",Zi="onesignal-reset",Xi="state-subscribed",tn="state-unsubscribed",en={qt:".onesignal-customlink-container",Ht:`.${Yi}`,Jt:`.${Qi}`},nn=class{Gt;constructor(t){this.Gt=t}async Yt(){if(!this.Gt?.enabled)return;if(!(await this.Qt()))return;ht._("Initializing customlink");const t=await OneSignal.M.gt.ht();if(this.Gt?.unsubscribeEnabled||!t)for(let e=0;e{ht._("CustomLink: clicked"),await this.ae(e)}),e.setAttribute("type","button"),t.appendChild(e)}}else ht.S("CustomLink: missing 'text' config")}async Qt(){return 0===await OneSignal.M.Wt.R()||(ht.p("CustomLink: styles failed to load"),!1)}oe(t){Se(t,"hide")}te(){this.Zt.forEach(t=>{this.oe(t)})}async ae(t){if(!OneSignal.User.PushSubscription.optedIn)return await OneSignal.User.PushSubscription.optIn(),void(this.Gt?.unsubscribeEnabled||this.te());await OneSignal.User.PushSubscription.optOut(),await this.se(t)}async se(t){this.Gt?.text?.subscribe&&(await OneSignal.M.gt.ht()||(t.textContent=this.Gt.text.subscribe)),this.Gt?.text?.unsubscribe&&await OneSignal.M.gt.ht()&&(t.textContent=this.Gt.text.unsubscribe)}ne(t){this.Gt?.color&&this.Gt.color.text&&("button"===this.Gt?.style&&this.Gt?.color.button?(t.style.backgroundColor=this.Gt?.color.button,t.style.color=this.Gt?.color.text):"link"===this.Gt?.style&&(t.style.color=this.Gt?.color.text))}get Zt(){const t=document.querySelectorAll(en.qt);return Array.prototype.slice.call(t)}},sn={re:0,ce:1},an="onesignal-pageview-count",on=!1;function rn(){try{const t=sessionStorage.getItem(an),e=t?parseInt(t):0;return isNaN(e)?0:e}catch{return 0}}function cn(){if(on)return;const t=rn()+1,e=le()+1;var i;!function(t){try{sessionStorage.setItem(an,t.toString())}catch{}}(t),i=e,localStorage.setItem(se,i.toString()),on=!0,ht.p(`Page views: tab=${t}, total=${e}`)}function ln(){return 1===rn()}var un=class{},dn=class{le;constructor(){this.le={}}on(t,e){return this.le[t]=this.le[t]||[],this.le[t].push(e),this}once(t,e){const i=this;function n(...s){i.off(t,n),e.apply(this,s)}return n.listener=e,this.on(t,n),this}off(t,e){const i=this.le[t];if(void 0!==i){for(let t=0;t{gn(t)&&(this.fe=t.id)}).catch(t=>{ht.S(t)}),OneSignal.P.on(OneSignal.EVENTS.SUBSCRIPTION_CHANGED,t=>{this.fe=t?.current.id,this.we=t?.current.token}),OneSignal.P.on(OneSignal.EVENTS.NOTIFICATION_PERMISSION_CHANGED_AS_STRING,t=>{this.be=t})):ht.m(`PushSubscriptionNamespace: skipping initialization. One or more required params are falsy: initialize: ${t}, subscription: ${JSON.stringify(e)}`)}get id(){return hn.pe(this.fe)?void 0:this.fe}get token(){return this.we}get optedIn(){return!!this._e&&"granted"===this.be}async optIn(){Ue("optIn"),await Me(),this._e=!0,"granted"===await OneSignal.M.A.N()?await this.Se(!0):await OneSignal.Notifications.requestPermission()}async optOut(){Ue("optOut"),await Me(),this._e=!1,await this.Se(!1)}addEventListener(t,e){OneSignal.P.on(t,e)}removeEventListener(t,e){OneSignal.P.off(t,e)}async Se(t){await Me();const e=await ue(),i=await fe();if(!e.appId)throw Z;if("boolean"!=typeof t)throw at("enabled");i.optedOut=!t,await we(i),Ye("subscription.optedOut",i.optedOut),Nn().catch(t=>{ht.S(t)})}},fn=class{ve=[];get Oe(){return this.ve.length>0}Ie(t){this.ve.push(t)}ke(t){const e=this.ve.indexOf(t);-1!==e&&this.ve.splice(e,1)}xe(t){for(const e of this.ve)t(e)}},wn=class{Ce;Ee=new Map;Pe=new fn;constructor(){this.Ce=Math.random().toString(36).substring(2)}$e(t){const{modelId:e,modelName:i,...n}=t;this.Ee.clear(),this.Ee=new Map(Object.entries(n)),e&&(this.Ce=e)}Te(t,e){const i=new Map;e.Ee.forEach((t,e)=>{i.set(e,t)}),null!==t&&(this.Ce=t),this.Ee.clear(),this.Ee=i}Ne(t,e,i=0,n=!1){const s=this.Ee.get(t);(s!==e||n)&&(void 0!==e?this.Ee.set(t,e):this.Ee.has(t)&&this.Ee.delete(t),this.Ae(t,i,s,e))}Me(t){return this.Ee.has(t)}Ue(t,e){return this.Ee.get(t)??e}Ae(t,e,i,n){const s={model:this,property:t,oldValue:i,newValue:n};this.Pe.xe(t=>t.De(s,e))}toJSON(){return Object.fromEntries(this.Ee.entries())}Ie(t){return this.Pe.Ie(t)}ke(t){this.Pe.ke(t)}get Oe(){return this.Pe.Oe}Le(t){for(const[e,i]of Object.entries(t))this.Ee.set(e,i)}},_n=class extends wn{constructor(){super(),this.sdk=C,this.device_model=L(),this.device_os=D()}get Fe(){return this.Ue("onesignalId")}set Fe(t){this.Ne("onesignalId",t)}get id(){return this.Ue("id")}set id(t){this.Ne("id",t)}get enabled(){return this.Ue("enabled")}set enabled(t){this.Ne("enabled",t)}get type(){return this.Ue("type")}set type(t){this.Ne("type",t)}get token(){return this.Ue("token")}set token(t){this.Ne("token",t)}get Re(){return this.Ue("notification_types")}set Re(t){this.Ne("notification_types",t)}get sdk(){return this.Ue("sdk")}set sdk(t){this.Ne("sdk",t)}get device_model(){return this.Ue("device_model")}set device_model(t){this.Ne("device_model",t)}get device_os(){return this.Ue("device_os")}set device_os(t){this.Ne("device_os",t)}get web_auth(){return this.Ue("web_auth")}set web_auth(t){this.Ne("web_auth",t)}get web_p256(){return this.Ue("web_p256")}set web_p256(t){this.Ne("web_p256",t)}},bn=class extends wn{constructor(t,e,i){super(),this.t=t,e&&(this.We=e),i&&(this.Fe=i)}get t(){return this.Ue("name")}set t(t){this.Ne("name",t)}get We(){return this.Ue("appId")}set We(t){this.Ne("appId",t)}get Fe(){return this.Ue("onesignalId")}set Fe(t){this.Ne("onesignalId",t)}get Be(){return this.Fe}get je(){return""}get ze(){return 1}get Ke(){return!hn.pe(this.Fe)}Ve(t){t[this.Fe]&&(this.Fe=t[this.Fe])}},mn=class extends bn{constructor(t,e,i,n){super(j,t,e),i&&(this.qe=i),n&&(this.He=n)}get qe(){return this.Ue("externalId")}set qe(t){this.Ne("externalId",t)}get He(){return this.Ue("existingOnesignalId")}set He(t){this.Ne("existingOnesignalId",t)}get je(){return`${this.We}.User.${this.Fe}`}get Je(){return""}get ze(){return 0}get Ke(){return!this.He||!hn.pe(this.He)}get Be(){return this.He??this.Fe}Ve(t){this.He&&t[this.He]&&(this.He=t[this.He])}},yn=class t{static Ge;static Ye(){if(!t.Ge){t.Ge=new t;const e=OneSignal.ye.Qe(),i=OneSignal.ye.Ze(),n=e.Fe??hn.ge();e.Fe||e.Ne(G,n,1),i.Fe||i.Ne("onesignalId",n,1)}return t.Ge}Xe(t){const e=OneSignal.ye.Qe();Object.keys(t).forEach(i=>{e.Ne(i,t[i])})}get onesignalId(){const t=OneSignal.ye.Qe().Fe;return hn.pe(t)?void 0:t}get externalId(){return OneSignal.ye.Qe()?.qe}addAlias(t,e){Ue("addAlias",{label:t,id:e}),ge()||(Cn(t,"label"),xn(e,"id"),this.addAliases({[t]:e}))}addAliases(t){if(Ue("addAliases",{aliases:t}),!ge()){!function(t,e){if(!rt(t))throw ot(e);if(!t||0===Object.keys(t).length)throw st(e)}(t,"aliases");for(const e of Object.keys(t))xn(t[e],`key: ${e}`),Cn(e,`key: ${e}`);this.Xe(t)}}removeAlias(t){Ue("removeAlias",{label:t}),ge()||this.removeAliases([t])}removeAliases(t){if(Ue("removeAliases",{aliases:t}),ge())return;In(t,"aliases");const e=Object.fromEntries(t.map(t=>[t,void 0]));this.Xe(e)}addEmail(t){if(Ue("addEmail",{email:t}),!ge()){if(On(t,"email"),!function(t){return!!t&&!!t.match(/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/)}(t))throw at("email");vn({type:l,token:t})}}addSms(t){Ue("addSms",{sms:t}),ge()||(On(t,"sms"),vn({type:"SMS",token:t}))}removeEmail(t){Ue("removeEmail",{email:t}),ge()||(On(t,"email"),OneSignal.ye.ti().forEach(e=>{e.token===t&&OneSignal.ye.ei(e.Ce)}))}removeSms(t){Ue("removeSms",{smsNumber:t}),ge()||(On(t,"smsNumber"),OneSignal.ye.ii().forEach(e=>{e.token===t&&OneSignal.ye.ei(e.Ce)}))}addTag(t,e){Ue("addTag",{key:t,value:e}),ge()||(On(t,"key"),On(e,"value"),this.addTags({[t]:e}))}addTags(t){if(ge())return;const e=OneSignal.ye.Ze();e.ni={...e.ni,...t}}removeTag(t){Ue("removeTag",{tagKey:t}),ge()||(On(t,"tagKey"),this.removeTags([t]))}removeTags(t){if(Ue("removeTags",{tagKeys:t}),ge())return;In(t,"tagKeys",On);const e=OneSignal.ye.Ze(),i={...e.ni};t.forEach(t=>{i[t]=""}),e.ni=i}getTags(){return Ue("getTags"),OneSignal.ye.Ze().ni}setLanguage(t){Ue("setLanguage",{language:t}),ge()||(On(t,"language"),OneSignal.ye.Ze().si=t)}getLanguage(){return Ue("getLanguage"),OneSignal.ye.Ze().si}trackEvent(t,e={}){if(ge())return;const i=OneSignal.ye.Qe().Fe;!hn.pe(i)||Sn(i)?function(t){if(!rt(t))return!1;try{return JSON.stringify(t),!0}catch{return!1}}(e)?(Ue("trackEvent",{name:t,properties:e}),OneSignal.ye.oi.ai({name:t,properties:e})):ht.S("Properties not serializable"):ht.S("User not logged in")}};function Sn(t){return OneSignal.ye.ci.ri.find(e=>e.operation instanceof mn&&e.operation.Fe===t)}function vn({type:t,token:e}){if(OneSignal.ye.ui.li().find(i=>i.token===e&&i.type===t))return;const i=OneSignal.ye.Qe(),n=i.Fe;if(hn.pe(n)){const t=Ve();Sn(n)||OneSignal.ye.ci.di(new mn(t,n,i.qe))}const s={id:hn.ge(),enabled:!0,notification_types:1,onesignalId:n,token:e,type:t},a=new _n;a.Le(s),OneSignal.ye.hi(a)}function On(t,e){if("string"!=typeof t)throw ot(e);if(!t)throw st(e)}function In(t,e,i=Cn){if(!Array.isArray(t))throw ot(e);if(0===t.length)throw st(e);for(const n of t)i(n,"label")}var kn=/[/?#&=\s\x00-\x1F\x7F]|\.\./;function xn(t,e){if(On(t,e),t.length>128||kn.test(t))throw at(e)}function Cn(t,e){if(xn(t,e),"external_id"===t||"onesignal_id"===t)throw new Error(`"${t}" is reserved`)}var En=class t extends un{gi;PushSubscription=new pn(!1);static P=new dn;constructor(t,e,i){super(),t&&(this.gi=yn.Ye(),this.PushSubscription=new pn(!0,e,i))}get onesignalId(){return this.gi?.onesignalId}get externalId(){return this.gi?.externalId}addAlias(t,e){this.gi?.addAlias(t,e)}addAliases(t){this.gi?.addAliases(t)}removeAlias(t){this.gi?.removeAlias(t)}removeAliases(t){this.gi?.removeAliases(t)}addEmail(t){this.gi?.addEmail(t)}removeEmail(t){this.gi?.removeEmail(t)}addSms(t){this.gi?.addSms(t)}removeSms(t){this.gi?.removeSms(t)}addTag(t,e){this.gi?.addTag(t,e)}addTags(t){this.gi?.addTags(t)}removeTag(t){this.gi?.removeTag(t)}removeTags(t){this.gi?.removeTags(t)}getTags(){return this.gi?.getTags()||{}}setLanguage(t){this.gi?.setLanguage(t)}getLanguage(){return this.gi?.getLanguage()||""}trackEvent(t,e){return this.gi?.trackEvent(t,e)}addEventListener(e,i){t.P.on(e,i)}removeEventListener(e,i){t.P.off(e,i)}},Pn=class{previousOneSignalId;previousExternalId};function $n(t,e){return t?t.filter(t=>t.type===e)[0]:void 0}function Tn(t){return t===xt||t===Ct}async function Nn(){Ue("checkAndTriggerSubscriptionChanged");const t=OneSignal.M,e=await OneSignal.M.gt.ht(),i=await OneSignal.M.gt.pi(),n=await de(),{lastKnownPushEnabled:s,lastKnownPushId:a,lastKnownPushToken:o,lastKnownOptedIn:r}=n,c=await qe(),l=(await OneSignal.ye.me())?.id;if(e===s&&c===o&&l===a)return;await t.gt.fi(),n.lastKnownPushEnabled=e,n.lastKnownPushToken=c,n.lastKnownPushId=l,n.lastKnownOptedIn=i,await he(n);const u={previous:{id:a,token:o,optedIn:r??!0},current:{id:l,token:c,optedIn:i}};ht._("Push sub changed:",u),function(t){Re.$(OneSignal.EVENTS.SUBSCRIPTION_CHANGED,t)}(u)}function An(t){(function(t,e){if(OneSignal.bt)return void ht.p("Skipping welcome notif: already subscribed");const i=OneSignal.config?.userConfig.welcomeNotification;if(void 0!==i&&!0===i.disable)return;if(!0!==t)return;if(!e)return;let n=void 0!==i&&void 0!==i.title&&null!==i.title?i.title:"",s=void 0!==i&&void 0!==i.message&&null!==i.message&&i.message.length>0?i.message:"Thanks for subscribing!";const a=new URL(location.href).origin+"?_osp=do_not_open",o=i&&i.url&&i.url.length>0?i.url:a;n=Oe(n),s=Oe(s),ht.p("Sending welcome notif"),async function(t,e,i,n,s){if(Ue("MainHelper:showLocalNotification: ",t,e,i,n,s,void 0),!(await ue()).appId)throw Z;if(!OneSignal.Notifications.permission)throw new Error("User is not subscribed");if(!ct(i))throw at("url");if(!ct(n,{allowEmpty:!0,requireHttps:!0}))throw at("icon");n||(n=Fe(await Ke()));const a={data:s,launchURL:i,buttons:void 0};OneSignal.M.D.U().then(async i=>{if(!i)return void ht.S("SW registration unavailable");const s={body:e,data:a,icon:n,actions:[]};await i.showNotification(t,s)})}(n,s,o,void 0,{wi:!0}),Re.$(OneSignal.EVENTS.WELCOME_NOTIFICATION_SENT,{title:n,message:s,url:o})})(t?.current?.optedIn,t?.current?.id),function(t){if(!0!==t)return;const e=OneSignal.M._i.userConfig.promptOptions?.slidedown?.prompts;(function(t){if(!t)return!1;const e=$n(t,Ct);return!!e&&!!e.categories&&e.categories.length>0})(e)&&OneSignal.M.mi.bi()}(t?.current?.optedIn),function(){if(!OneSignal.config?.userConfig.notifyButton)return;const t=OneSignal.config.userConfig.notifyButton.displayPredicate;t&&"function"==typeof t&&OneSignal.yi&&(!1!==t()?(ht.p("Showing notify button: predicate true"),OneSignal.yi.Ft.H()):(ht.p("Hiding notify button: predicate false"),OneSignal.yi.Ft.J()))}(),OneSignal.config?.userConfig.promptOptions&&new nn(OneSignal.config?.userConfig.promptOptions.customlink).Yt()}async function Mn(){const t=OneSignal.M;let e=null;try{const i=await t.gt.Ie(sn.re);e=await t.gt.Si(i),cn(),await Be(),await Nn()}catch(i){ht.S(i)}return e}function Un(t){switch(t){case c:case u:case d:case h:return!0;default:return!1}}async function Dn(){if(ht.p("sessionInit()"),OneSignal.Oi)return void ht.p("sessionInit already running");OneSignal.Oi=!0;try{await async function(){const t=[];t.push(async function(){const t=await OneSignal.M.gt.ht(),e=await OneSignal.M.A.N();Ye("subscription.optedOut",await OneSignal.M.gt.Ii()),await te.put("Options",{key:"isPushEnabled",value:t}),await te.put("Options",{key:"notificationPermission",value:e})}()),t.push(async function(){try{navigator.permissions&&((await navigator.permissions.query({name:"notifications"})).onchange=function(){Be()})}catch(t){ht.m(`Permission change hook failed: ${String(t)}`)}}()),t.push(("granted"===OneSignal.M.A.ki(OneSignal.M._i.safariWebId)&&(OneSignal.bt=!0),Promise.resolve())),t.push(function(){if(navigator.serviceWorker&&window.isSecureContext)try{OneSignal.M.D.xi()}catch(t){ht.S(t)}return Promise.resolve()}()),function(){if(!OneSignal.yi){OneSignal.config.userConfig.notifyButton=OneSignal.config.userConfig.notifyButton||{},OneSignal.config.userConfig.bell&&(OneSignal.config.userConfig.bell={...OneSignal.config.userConfig.bell,...OneSignal.config.userConfig.notifyButton},OneSignal.config.userConfig.notifyButton={...OneSignal.config.userConfig.notifyButton,...OneSignal.config.userConfig.bell});const t=OneSignal.config.userConfig.notifyButton.displayPredicate;t&&"function"==typeof t?OneSignal.P.once(OneSignal.EVENTS.SDK_INITIALIZED,async()=>{!1!==await Promise.resolve(OneSignal.config.userConfig.notifyButton.displayPredicate?.())?(OneSignal.yi=new bi(OneSignal.config.userConfig.notifyButton),OneSignal.yi.Rt()):ht.p("Notify button predicate returned false")}):(OneSignal.yi=new bi(OneSignal.config.userConfig.notifyButton),OneSignal.yi.Rt())}}(),t.push(async function(){const t=OneSignal.config;t.userConfig.promptOptions&&await new nn(t.userConfig.promptOptions.customlink).Yt()}());try{await Promise.all(t)}catch(e){throw ht.S(e),new Error("Unknown init error")}}()}catch(n){if(n instanceof Error)return;throw n}const t=await OneSignal.M.gt.Ii()??!1,e=await fe();e.optedOut=t,await we(e),await async function(t){ht._("handleAutoResubscribe",{autoResubscribe:OneSignal.config?.userConfig.autoResubscribe,isOptedOut:t}),OneSignal.config?.userConfig.autoResubscribe&&!t&&"granted"==OneSignal.M.A.ki(OneSignal.M._i.safariWebId)&&await Mn()}(t);const i=await OneSignal.M.gt.ht();await te.put("Options",{key:"isPushEnabled",value:!!i}),OneSignal.config?.userConfig.promptOptions?.autoPrompt&&!t&&OneSignal.M.Ei.Ci(),OneSignal.Oi=!1,Re.$(OneSignal.EVENTS.SDK_INITIALIZED)}async function Ln(){return!!(await Mn())}async function Fn(){const t=await async function(){const t=OneSignal.M;if(ht.p("Checking sub expiration"),!(await t.gt.Pi()))return ht.p("Sub not expired"),!1;ht.p("Sub expiring");const e=await t.gt.Ie(sn.ce);return await t.gt.Si(e),!0}();await OneSignal.M.gt.$i()?(OneSignal.M.Ni.Ti(),t||await OneSignal.M.Mi.Ai()):OneSignal.config?.userConfig.promptOptions?.autoPrompt||OneSignal.config?.userConfig.autoResubscribe||await OneSignal.M.Mi.Ai(),Re.$(OneSignal.EVENTS.SDK_INITIALIZED_PUBLIC)}var Rn=class extends bn{constructor(t){super(H,t?.appId,t?.onesignalId),t?.externalId&&(this.qe=t.externalId),t?.timestamp&&(this.Ui=t.timestamp),t?.event&&(this.Di=t.event)}get qe(){return this.Ue("externalId")}set qe(t){this.Ne("externalId",t)}get Ui(){return this.Ue("timestamp")}set Ui(t){this.Ne("timestamp",t)}get Di(){return this.Ue("event")}set Di(t){this.Ne("event",t)}get key(){return`${this.We}.User.${this.Fe}.CustomEvent.${this.Di.name}`}get je(){return this.key}get Je(){return this.key}get ze(){return 2}get Ke(){return!hn.pe(this.Fe)}get Be(){return this.Fe}Ve(t){t[this.Fe]&&(this.Fe=t[this.Fe])}},Wn=class{Li;Fi;constructor(t,e){this.Li=t,this.Fi=e}ai(t){const e=Ve(),i=this.Li.Ri,n=new Rn({appId:e,onesignalId:i.Fe,externalId:i.qe,timestamp:(new Date).toISOString(),event:t});this.Fi.di(n)}};function Bn(t){switch(t){case 400:case 402:return 0;case 401:case 403:return 2;case 404:case 410:return 3;case 409:return 4;default:return 1}}var jn=class{get Wi(){return[H]}get Bi(){return{sdk:C,device_model:L(),device_os:D(),type:U()}}async ji(t){ht.p(`CustomEventOpExec(${JSON.stringify(t)})`);const e=t[0];if(!(e instanceof Rn))throw new Error(`Unrecognized operation! Expected TrackEventOperation, got: ${e.constructor.name}`);const{ok:i,status:n}=await async function(t,e){const{appId:i}=t;return pt(`apps/${i}/custom_events`,{events:[e]},t.jwtHeader)}({appId:e.We},{name:e.Di.name,onesignal_id:e.Fe,external_id:e.qe,timestamp:e.Ui,payload:{...e.Di.properties,os_sdk:this.Bi}}),s=Bn(n);return i?{zi:0}:1===s?{zi:2}:{zi:3}}},zn=class extends bn{constructor(t,e,i,n){super(t,e,i),n&&(this.label=n)}get label(){return this.Ue("label")}set label(t){this.Ne("label",t)}},Kn=class extends zn{constructor(t,e,i){super(R,t,e,i)}get Je(){return`${this.We}.User.${this.Fe}.Alias.${this.label}`}get ze(){return 2}},Vn=class extends zn{constructor(t,e,i,n){super(F,t,e,i),n&&(this.value=n)}get value(){return this.Ue("value")}set value(t){this.Ne("value",t)}get Je(){return`${this.We}.User.${this.Fe}.Identity.${this.label}`}},qn=class{Li;Ki;Vi;constructor(t,e,i){this.Li=t,this.Ki=e,this.Vi=i}get Wi(){return[F,R]}async ji(t){if(ht.p(`IdentityOpExec(${JSON.stringify(t)})`),t.filter(t=>!(t instanceof Vn||t instanceof Kn)).length>0)throw new Error(`Unrecognized operation(s)! Attempted operations:\n${JSON.stringify(t)}`);const e=t.some(t=>t instanceof Vn),i=t.some(t=>t instanceof Kn);if(e&&i)throw new Error("Can't process SetAliasOperation and DeleteAliasOperation at the same time.");const n=t[t.length-1],s=n instanceof Vn,{ok:a,status:o,retryAfterSeconds:r}=await(s?async function(t,e,i){const{appId:n}=t;return wt(`apps/${n}/users/by/${e.label}/${e.id}/identity`,{identity:i},t.jwtHeader)}({appId:n.We},{label:G,id:n.Fe},{[n.label]:n.value}):async function(t,e,i){const{appId:n}=t;return ft(`apps/${n}/users/by/${e.label}/${e.id}/identity/${i}`,t.jwtHeader)}({appId:n.We},{label:G,id:n.Fe},n.label));if(a)return this.Li.Ri.Fe===n.Fe&&this.Li.Ri.Ne(n.label,s?n.value:void 0,2),{zi:0};switch(Bn(o)){case 1:return{zi:2,qi:r};case 0:return{zi:3};case 4:return s?{zi:5,qi:r}:{zi:0};case 2:return{zi:4,qi:r};case 3:if(404===o&&this.Vi.Hi(n.Fe))return{zi:2,qi:r};if(s){const t=await this.Ki.Ji(n.We,n.Fe);return null==t?{zi:3}:{zi:2,qi:r,Wi:t}}return{zi:0}}}},Hn=class extends bn{constructor(t,e,i,n){super(t,e,i),n&&(this.Gi=n)}get Gi(){return this.Ue("subscriptionId")}set Gi(t){this.Ne("subscriptionId",t)}get je(){return`${this.We}.User.${this.Fe}`}get Je(){return`${this.We}.User.${this.Fe}.Subscription.${this.Gi}`}get Ke(){return!hn.pe(this.Fe)&&!hn.pe(this.Gi)}get Be(){return this.Gi}Ve(t){super.Ve(t),t[this.Gi]&&(this.Gi=t[this.Gi])}},Jn=class extends Hn{constructor(t,e,i,n){super(t,e,i),n&&(this.sdk=C,this.device_model=L(),this.device_os=D(),this.enabled=n.enabled,this.notification_types=n.notification_types,this.Gi=n.subscriptionId,this.token=n.token,this.type=n.type,this.web_auth=n.web_auth,this.web_p256=n.web_p256)}get type(){return this.Ue("type")}set type(t){this.Ne("type",t)}get token(){return this.Ue("token")}set token(t){this.Ne("token",t)}get enabled(){return this.Ue("enabled")}set enabled(t){this.Ne("enabled",t)}get notification_types(){return this.Ue("notification_types")}set notification_types(t){this.Ne("notification_types",t)}get sdk(){return this.Ue("sdk")}set sdk(t){this.Ne("sdk",t)}get device_model(){return this.Ue("device_model")}set device_model(t){this.Ne("device_model",t)}get device_os(){return this.Ue("device_os")}set device_os(t){this.Ne("device_os",t)}get web_auth(){return this.Ue("web_auth")}set web_auth(t){this.Ne("web_auth",t)}get web_p256(){return this.Ue("web_p256")}set web_p256(t){this.Ne("web_p256",t)}},Gn=class extends Jn{constructor(t){super(z,t?.appId,t?.onesignalId,t)}get Ke(){return!hn.pe(this.Fe)}get Be(){return this.Fe}Ve(t){t[this.Fe]&&(this.Fe=t[this.Fe])}},Yn=class extends Hn{constructor(t,e,i){super(V,t,e),i&&(this.Gi=i)}get ze(){return 2}},Qn=class extends bn{constructor(t,e){super(B,t,e)}get je(){return`${this.We}.User.${this.Fe}.Refresh`}get Je(){return`${this.We}.User.${this.Fe}.Refresh`}get ze(){return 0}},Zn=class extends Hn{constructor(t,e,i){super(q,t,e),i&&(this.Gi=i)}get ze(){return 2}get Je(){return`${this.We}.Subscription.${this.Gi}.Transfer`}},Xn=class extends Jn{constructor(t){super(K,t?.appId,t?.onesignalId,t)}},ts=class{Yi;Li;Qi;Zi;constructor(t,e,i,n){this.Yi=t,this.Li=e,this.Qi=i,this.Zi=n}get Wi(){return[j]}async ji(t){ht.p(`LoginUserOpExec(${JSON.stringify(t)})`);const e=t[0];if(e instanceof mn)return this.Xi(e,t.slice(1));throw new Error(`Unrecognized operation: ${e.t}`)}async Xi(t,e){if(!t.He||!t.qe)return this.tn(t,e);const i=await this.Yi.ji([new Vn(t.We,t.He,J,t.qe)]);switch(i.zi){case 0:{const e=t.He,i=t.Fe;return this.Li.Ri.Fe===i&&this.Li.Ri.Ne(G,e,2),this.Qi.Ri.Fe===i&&this.Qi.Ri.Ne("onesignalId",e,2),{zi:1,en:{[t.Fe]:e}}}case 5:return ht.p(`409 conflict: ${t.qe}`),this.tn(t,e);case 3:return ht.S(`SetAlias failed: ${t.qe}`),this.tn(t,e);default:return{zi:i.zi}}}async tn(t,e){const i={};let n={};const s={timezone_id:ss(),language:ns()};t.qe&&(i[J]=t.qe);for(const l of e){if(!(l instanceof Gn||l instanceof Zn||l instanceof Xn||l instanceof Yn))throw new Error(`Unrecognized operation: ${l.t}`);n=this.nn(l,n)}const a=Object.entries(n);if(0===Object.keys(i).length&&0===a.length)return ht.p("CreateUser: skipped, no identity and no subscriptions"),{zi:3};const o=await async function(t,e){const{appId:i,subscriptionId:n}=t,s=n?{"OneSignal-Subscription-Id":n}:void 0;let a={};return s&&(a={...a,...s}),t.jwtHeader&&(a={...a,...t.jwtHeader}),e.refresh_device_metadata=!0,pt(`apps/${i}/users`,e,a)}({appId:t.We},{identity:i,subscriptions:a.map(([,t])=>t),properties:s});if(o.ok){const e=o.result.identity.onesignal_id,n=t.Fe,s={[t.Fe]:e},r=this.Li.Ri.Fe===n;if(r){this.Li.Ri.Ne(G,e,2),this.Qi.Ri.Ne("onesignalId",e,2);const t=o.result.properties;if(t)for(const[e,i]of Object.entries(t))this.Qi.Ri.Ne(e,i,2)}for(let t=0;t{const t=new Pn;return t.previousOneSignalId="",t.previousExternalId="",t.previousOneSignalId=await ee("previousOneSignalId"),t.previousExternalId=await ee("previousExternalId"),t})(),{previousOneSignalId:e,previousExternalId:i}=t,n=OneSignal.ye.Qe(),s=n?.Fe,a=n?.qe;if(s===e&&a===i)return;t.previousOneSignalId=s,t.previousExternalId=a,await(async t=>{await te.put("Options",{key:"previousOneSignalId",value:t.previousOneSignalId}),await te.put("Options",{key:"previousExternalId",value:t.previousExternalId})})(t);const o={current:{onesignalId:s,externalId:a}};ht._("User changed:",o),function(t){Re.$(OneSignal.EVENTS.SUBSCRIPTION_CHANGED,t,En.P)}(o)}();return{zi:0,Wi:Object.keys(i).length>0?[new Qn(t.We,e)]:void 0,en:s}}const{status:r,retryAfterSeconds:c}=o;switch(Bn(r)){case 1:return{zi:2,qi:c};case 2:return{zi:4,qi:c};default:return{zi:6}}}nn(t,e){switch(!0){case t instanceof Gn:{const i=t.Gi;return{...e,[i]:{enabled:t.enabled,device_model:t.device_model,device_os:t.device_os,notification_types:t.notification_types,sdk:t.sdk,token:t.token,type:t.type,web_auth:t.web_auth,web_p256:t.web_p256}}}case t instanceof Xn:{const i=t.Gi;return e[i]?{...e,[i]:{...e[i],enabled:t.enabled,notification_types:t.notification_types,token:t.token}}:e}case t instanceof Zn:{const i=t.Gi;if(hn.pe(i)){if(e[i])return e;const t=this.Zi.sn(i);return t?.token?{...e,[i]:{enabled:t.enabled,device_model:t.device_model,device_os:t.device_os,notification_types:t.Re,sdk:t.sdk,token:t.token,type:t.type,web_auth:t.web_auth,web_p256:t.web_p256}}:e}return{...e,[i]:{...e[i],id:i}}}case t instanceof Yn:{const i={...e};return delete i[t.Gi],i}default:return e}}},es=["tw","hant"],is=["cn","hans"],ns=()=>{let t=navigator.language;if(t){t=t.toLowerCase();const e=t.split("-");if("zh"==e[0]){for(const t of es)if(-1!==e.indexOf(t))return"zh-Hant";for(const t of is)if(-1!==e.indexOf(t))return"zh-Hans";return"zh-Hant"}return e[0].substring(0,2)}return"en"},ss=()=>Intl.DateTimeFormat().resolvedOptions().timeZone,as=class extends wn{get Fe(){return this.Ue(G)}set Fe(t){this.Ne(G,t)}get qe(){return this.Ue(J)}set qe(t){this.Ne(J,t)}},os=class extends wn{constructor(){super()}get Fe(){return this.Ue("onesignalId")}set Fe(t){this.Ne("onesignalId",t)}get an(){return this.Ue("ip")}set an(t){this.Ne("ip",t)}get rn(){return this.Ue("country")}set rn(t){this.Ne("country",t)}get si(){return this.Ue("language")}set si(t){this.Ne("language",t)}get cn(){return this.Ue("timezone_id")}set cn(t){this.Ne("timezone_id",t)}get ni(){return this.Ue("tags")??{}}set ni(t){this.Ne("tags",t)}},rs=class{Li;Qi;Zi;Ki;Vi;constructor(t,e,i,n,s){this.Li=t,this.Qi=e,this.Zi=i,this.Ki=n,this.Vi=s}get Wi(){return[B]}async ji(t){if(ht.p(`RefreshUserOpExec(${JSON.stringify(t)})`),t.some(t=>!(t instanceof Qn)))throw new Error(`Unrecognized operation(s)! Attempted operations:\n${JSON.stringify(t)}`);const e=t[0];return this.ln(e)}async ln(t){const{ok:e,result:i,retryAfterSeconds:n,status:s}=await async function(t,e){const{appId:i}=t;return _t("GET",`apps/${i}/users/by/${e.label}/${e.id}`,t.jwtHeader,n);var n}({appId:t.We},{label:G,id:t.Fe});if(e){if(t.Fe!==this.Li.Ri.Fe)return{zi:0};const e=new as;for(const[t,c]of Object.entries(i.identity))e.Ne(t,c);const n=new os;n.Fe=t.Fe;const{properties:s={},subscriptions:a=[]}=i;Object.entries(s).forEach(([t,e])=>{n.Ne(t,e)});const o=[];for(const i of a){const e=new _n;e.id=i.id,e.token=i.token??"",e.Re=i.notification_types??1,e.type=i.type,e.enabled=-2!==e.Re,e.sdk=i.sdk,e.device_os=i.device_os,e.device_model=i.device_model,e.Fe=t.Fe,Un(e.type)||o.push(e)}const r=await OneSignal.ye.me();return r&&(r.Fe=t.Fe,o.push(r)),this.Li.un(e,2),this.Qi.un(n,2),this.Zi.dn(o,2),{zi:0}}switch(Bn(s)){case 1:return{zi:2,qi:n};case 2:return{zi:4,qi:n};case 3:{if(404===s&&this.Vi.Hi(t.Fe))return{zi:2,qi:n};const e=await this.Ki.Ji(t.We,t.Fe);return e?{zi:2,qi:n,Wi:e}:{zi:3}}default:return{zi:3}}}},cs=class{ui;Ki;Vi;constructor(t,e,i){this.ui=t,this.Ki=e,this.Vi=i}get Wi(){return[z,K,V,q]}async ji(t){ht.p(`SubOpExec(${JSON.stringify(t)})`);const e=t[0];if(e instanceof Gn)return this.hn(e,t);if(t.some(t=>t instanceof Yn)){if(t.length>1)throw new Error(`Only supports one operation! Attempted operations:\n${JSON.stringify(t)}`);return this.gn(t[0])}if(e instanceof Xn)return this.pn(t);if(e instanceof Zn){if(t.length>1)throw new Error(`TransferSubscriptionOperation only supports one operation! Attempted operations:\n${JSON.stringify(t)}`);return this.fn(e)}throw new Error(`Unrecognized operation: ${JSON.stringify(e)}`)}async hn(t,e){if(e.some(t=>t instanceof Yn))return{zi:0};const i=[...e].reverse().find(t=>t instanceof Xn),n=i?.enabled??t.enabled,s=i?.token??t.token,a=i?.notification_types??t.notification_types,o={sdk:t.sdk,type:t.type,enabled:n,token:s,notification_types:a},r=await async function(t,e,i){const{appId:n}=t;return pt(`apps/${n}/users/by/${e.label}/${e.id}/subscriptions`,i,t.jwtHeader)}({appId:t.We},{label:G,id:t.Fe},{subscription:o});if(r.ok){const{subscription:e}=r.result,i=this.ui.sn(t.Gi),n=e?.id;return n&&(i?.Ne("id",n,2),i?.Ne("onesignalId",t.Fe,2)),{zi:0,Wi:n?void 0:[new Qn(t.We,t.Fe)],en:n?{[t.Gi]:n}:void 0}}const{retryAfterSeconds:c,status:l}=r;switch(Bn(l)){case 1:return{zi:2,qi:c};case 2:return{zi:4,qi:c};case 4:case 0:return{zi:3};case 3:{if(404===l&&this.Vi.Hi(t.Fe))return{zi:2,qi:c};const e=await this.Ki.Ji(t.We,t.Fe);return e?{zi:2,qi:c,Wi:e}:{zi:3}}}}async pn(t){const e=t[t.length-1],i={type:e.type,enabled:e.enabled,token:e.token,notification_types:e.notification_types,web_auth:e.web_auth,web_p256:e.web_p256},n=await async function(t,e,i){const{appId:n}=t;return wt(`apps/${n}/subscriptions/${e}`,{subscription:i})}({appId:e.We},e.Gi,i);if(n.ok)return{zi:0};const{retryAfterSeconds:s,status:a}=n;switch(Bn(a)){case 1:return{zi:2,qi:s};case 3:return 404===a&&[e.Fe,e.Gi].some(t=>this.Vi.Hi(t))?{zi:2,qi:s}:{zi:3,Wi:[new Gn({appId:e.We,enabled:e.enabled,notification_types:e.notification_types,onesignalId:e.Fe,subscriptionId:e.Gi,token:e.token,type:e.type})]};default:return{zi:3}}}async fn(t){const e=await async function(t,e,i){const{appId:n}=t;return wt(`apps/${n}/subscriptions/${e}/owner`,{identity:{...i}},t.jwtHeader)}({appId:t.We},t.Gi,{onesignal_id:t.Fe});if(e.ok)return{zi:0};const{retryAfterSeconds:i,status:n}=e;return 1===Bn(n)?{zi:2,qi:i}:{zi:3}}async gn(t){const e=await async function(t,e){const{appId:i}=t;return ft(`apps/${i}/subscriptions/${e}`)}({appId:t.We},t.Gi);if(e.ok)return this.ui.wn(t.Gi,2),{zi:0};const{retryAfterSeconds:i,status:n}=e;switch(Bn(n)){case 3:return[t.Fe,t.Gi].some(t=>this.Vi.Hi(t))?{zi:2,qi:i}:{zi:0};case 1:return{zi:2,qi:i};default:return{zi:3}}}},ls=class extends bn{constructor(t,e,i,n){super(W,t,e),i&&n&&(this._n=i,this.value=n)}get _n(){return this.Ue("property")}set _n(t){this.Ne("property",t)}get value(){return this.Ue("value")}set value(t){this.Ne("value",t)}get Je(){return`${this.We}.User.${this.Fe}`}},us=class{Li;Qi;Ki;Vi;constructor(t,e,i,n){this.Li=t,this.Qi=e,this.Ki=i,this.Vi=n}get Wi(){return[W]}bn(t){let e=null,i=null,n={};for(const s of t){if(!(s instanceof ls))throw new Error(`Unrecognized operation: ${JSON.stringify(s)}`);e||(e=s.We,i=s.Fe),n=ds(s,n)}return{appId:e,onesignalId:i,propertiesObject:n,refreshDeviceMetadata:!1}}async ji(t){ht.p(`UpdateUserOpExec(${JSON.stringify(t)})`);const{appId:e,onesignalId:i,propertiesObject:n,refreshDeviceMetadata:s}=this.bn(t);if(!e||!i)return{zi:0};const{ok:a,retryAfterSeconds:o,status:r}=await mt({appId:e},{label:G,id:i},{properties:n,refresh_device_metadata:s}),c=t=>"tags"===t._n;if(a){if(this.Li.Ri.Fe===i)for(const e of t)if(e instanceof ls){let t=e.value;if(c(e)){t={...e.value};for(const e in t)""===t[e]&&delete t[e]}this.Qi.Ri.Ne(e._n,t,2)}return{zi:0}}switch(Bn(r)){case 1:return{zi:2,qi:o};case 2:return{zi:4,qi:o};case 3:{if(404===r&&this.Vi.Hi(i))return{zi:2,qi:o};const t=await this.Ki.Ji(e,i);return t?{zi:2,qi:o,Wi:t}:{zi:3}}default:return{zi:3}}}};function ds(t,e){if(t instanceof ls){const i=t._n;return["ip","tags","language","timezone_id","country"].includes(i)?{...e,[i]:t.value}:{...e}}throw new Error(`Unsupported operation type: ${t.t}`)}var hs=class{mn;Fi;constructor(t,e){this.mn=t,this.Fi=e,this.mn.Ie(this)}yn(t,e){if(0!==e)return;const i=this.Sn(t);null!=i&&this.Fi.di(i)}vn(t,e){if(0!==e)return;const i=this.On(t.model,t.property,t.oldValue,t.newValue);null!=i&&this.Fi.di(i)}},gs=class extends hs{constructor(t,e){super(t,e)}Sn(t){return null}On(t,e,i,n){const s=Ve();return null!=n&&"string"==typeof n?new Vn(s,t.Fe,e,n):new Kn(s,t.Fe,e)}},ps=class extends hs{constructor(t,e){super(t,e)}Sn(t){return null}On(t,e,i,n){return new ls(Ve(),t.Fe,e,n)}},fs=class{mn;Fi;constructor(t,e){this.mn=t,this.Fi=e,this.mn.Ie(this)}In(){this.mn.ke(this)}kn(t,e){if(0!==e)return;const i=this.xn(t);null!=i&&this.Fi.di(i)}vn(t,e){if(0!==e)return;const i=this.On(t.model,t.property,t.oldValue,t.newValue);null!=i&&this.Fi.di(i)}Cn(t,e){if(0!==e)return;const i=this.En(t);null!=i&&this.Fi.di(i)}},ws=class t extends fs{Li;constructor(t,e,i){super(t,e),this.Li=i}xn(e){const{enabled:i,notification_types:n}=t.Pn(e);return new Gn({appId:Ve(),onesignalId:this.Li.Ri.Fe,subscriptionId:e.id,type:e.type,enabled:i,token:e.token,notification_types:n})}En(t){return new Yn(Ve(),this.Li.Ri.Fe,t.id)}On(e){const{enabled:i,notification_types:n}=t.Pn(e);return new Xn({appId:Ve(),onesignalId:this.Li.Ri.Fe,subscriptionId:e.id,type:e.type,enabled:i,token:e.token,notification_types:n,web_auth:e.web_auth,web_p256:e.web_p256})}static Pn(t){let e,i;return t.enabled&&1===t.Re&&t.token?(e=!0,i=1):(e=!1,i=t.enabled?t.Re:-2),{enabled:e,notification_types:i}}},_s=class{$n;Tn=new fn;Nn=[];An=!1;constructor(t){this.$n=t}Mn(t,e=0){const i=this.Nn.find(e=>e.Ce===t.Ce);i&&this.Un(i,e),this.Dn(t,e)}Ln(t,e,i=0){const n=this.Nn.find(t=>t.Ce===e.Ce);n&&this.Un(n,i),this.Dn(e,i,t)}li(){return this.Nn}Fn(t){return this.Nn.find(e=>e.Ce===t)}wn(t,e=0){const i=this.Nn.find(e=>e.Ce===t);i&&this.Un(i,e)}De(t,e){this.Rn(),this.Tn.xe(i=>i.vn(t,e))}dn(t,e=0){this.Wn(e);for(const i of t)this.Mn(i,e)}Wn(t=0){for(const e of this.Nn)e.ke(this),this.Tn.xe(i=>i.Cn(e,t)),te.delete(this.$n,e.Ce);this.Nn=[]}Dn(t,e,i){void 0!==i?this.Nn.splice(i,0,t):this.Nn.push(t),t.Ie(this),this.Rn(),this.Tn.xe(i=>i.kn(t,e))}async Un(t,e){const i=this.Nn.findIndex(e=>e.Ce===t.Ce);-1!==i&&this.Nn.splice(i,1),t.ke(this),await te.delete(this.$n,t.Ce),this.Rn(),this.Tn.xe(i=>i.Cn(t,e))}async B(){if(!this.$n)return;const t=await te.getAll(this.$n),e=this.Nn.length>0;for(let i=t.length-1;i>=0;i--){const e=this.Rt(t[i]);e&&(this.Nn.unshift(e),e.Ie(this))}this.An=!0,e&&this.Rn()}async Rn(){if(this.$n&&this.An)for(const t of this.Nn)await te.put(this.$n,{modelId:t.Ce,modelName:this.$n,...t.toJSON()})}Ie(t){this.Tn.Ie(t)}ke(t){this.Tn.ke(t)}get Oe(){return this.Tn.Oe}},bs=class extends _s{constructor(){super("operations")}async Bn(){return this.B()}Rt(t){if(null===t)return ht.S("null jsonObject in OpModelStore.create"),null;if(!this.jn(t))return null;const e=t.name;let i;switch(e){case F:i=new Vn;break;case R:i=new Kn;break;case z:i=new Gn;break;case K:i=new Xn;break;case V:i=new Yn;break;case q:i=new Zn;break;case j:i=new mn;break;case B:i=new Qn;break;case W:i=new ls;break;case H:i=new Rn;break;default:throw new Error(`Unrecognized operation: ${e}`)}return i.$e(t),i}jn(t){const e=t?.name;if(!e)return ht.S("Missing 'name' attribute"),!1;const i=new Set([j]);return!(!t.onesignalId&&!i.has(e)&&(ht.S(`${e} jsonObject must have 'onesignalId' attribute`),1))}},ms=class{Li;Qi;Zi;constructor(t,e,i){this.Li=t,this.Qi=e,this.Zi=i}async Ji(t,e){const i=new as;i.Te(null,this.Li.Ri),(new os).Te(null,this.Qi.Ri);const n=[];for(const o of this.Zi.li()){const t=new _n;t.Te(null,o),n.push(t)}if(i.Fe!==e)return null;const s=[];s.push(new mn(t,e,i.qe));const a=await OneSignal.ye.me();return a&&s.push(new Gn({appId:t,onesignalId:e,subscriptionId:a.id,type:a.type,enabled:a.enabled,token:a.token,notification_types:a.Re})),s.push(new Qn(t,e)),s}},ys=class extends _s{zn;constructor(t,e){super(e),this.zn=t,this.B()}Rt(t){const e=this.zn();return null!=t&&e.$e(t),e}},Ss=class{store;changeSubscription=new fn;constructor(t){this.store=t,t.Ie(this)}get Ri(){const t=this.store.li()[0];if(t)return t;const e=this.store.Rt();if(!e)throw new Error(`Unable to initialize model from store ${this.store.$n}`);return this.store.Mn(e),e}un(t,e){const i=this.Ri;i.Te(i.Ce,t),this.store.Rn(),this.changeSubscription.xe(t=>t.yn(i,e))}Ie(t){this.changeSubscription.Ie(t)}ke(t){this.changeSubscription.ke(t)}get Oe(){return this.changeSubscription.Oe}kn(){}vn(t,e){this.changeSubscription.xe(i=>i.vn(t,e))}Cn(){}},vs=class extends Ss{constructor(){super(new ys(()=>new as,"identity"))}},Os=class extends Ss{constructor(){super(new ys(()=>new os,"properties"))}},Is=class extends ys{constructor(){super(()=>new _n,"subscriptions")}sn(t){return super.li().find(e=>e.id===t)}dn(t,e){if(2!==e)return super.dn(t,e);for(const i of t)if(Un(i.type)){const t=this.Fn(i.Ce);t&&(i.sdk=t.sdk,i.device_os=t.device_os);break}super.dn(t,e)}},ks=class{Kn=new Map;get Vn(){return this.Kn}Mn(t){this.Kn.set(t,Date.now())}qn(t){if(!t)return!0;const e=this.Kn.get(t);return!e||Date.now()-e>=500}Hi(t){const e=this.Kn.get(t);return!!e&&Date.now()-e<=15e3}},xs=t=>{te.delete("operations",t.Ce)},Cs=class{Hn;ri=[];Jn=void 0;Gn=0;Yn;Vi;constructor(t,e,i){this.Yn=e,this.Vi=i,this.Hn=new Map;for(const n of t)for(const t of n.Wi)this.Hn.set(t,n)}Wn(){this.ri=[]}get Vn(){return this.Vi.Vn}get Qn(){return 0===this.Gn?0:this.Gn-1}Zn(t){return this.ri.some(e=>e.operation instanceof t)}async Xn(){await this.ts(),this.es()}ns(){clearInterval(this.Jn),this.Jn=void 0,ht.p("OpRepo: Paused")}di(t){ht.p(`OpRepo.enqueue: ${JSON.stringify(t)}`),this.ss({operation:t,bucket:this.Gn,retries:0},!0)}async rs(t){ht.p(`OpRepo.enqueueAndWait: ${JSON.stringify(t)}`),await new Promise((e,i)=>{this.ss({operation:t,bucket:this.Gn,retries:0,resolver:t=>t?e():i()},!0)})}ss(t,e,i){this.ri.some(e=>e.operation.Ce===t.operation.Ce)?ht.p(`OpRepo: duplicate modelId: ${t.operation.Ce}`):(void 0!==i?this.ri.splice(i,0,t):this.ri.push(t),e&&this.Yn.Mn(t.operation))}es(){this.Gn++;let t=!1;this.Jn=setInterval(async()=>{if(t)return ht.p("Ops in progress");const e=this.cs(this.Qn);e?(t=!0,await this.ls(e),t=!1):this.Gn++},500)}async ls(t){try{const e=t[0],i=this.Hn.get(e.operation.t);if(!i)throw new Error(`Could not find executor for operation ${e.operation.t}`);const n=t.map(t=>t.operation),s=await i.ji(n),a=s.en;ht.p(`OpRepo: result = ${s.zi}`),a&&(t.forEach(t=>t.operation.Ve(a)),this.ri.forEach(t=>t.operation.Ve(a)),Object.values(a).forEach(t=>this.Vi.Mn(t)));let o=0;switch(s.zi){case 0:t.forEach(t=>{this.Yn.wn(t.operation.Ce)}),t.forEach(t=>t.resolver?.(!0));break;case 4:case 3:case 5:ht.S(`Op failed (no retry): ${JSON.stringify(n)}`),t.forEach(t=>{this.Yn.wn(t.operation.Ce)}),t.forEach(t=>t.resolver?.(!1));break;case 1:this.Yn.wn(e.operation.Ce),e.resolver?.(!0),t.filter(t=>t!==e).reverse().forEach(t=>this.ri.unshift(t));break;case 2:ht.S(`Op failed, retrying: ${JSON.stringify(n)}`),[...t].reverse().forEach(t=>{xs(t.operation),t.retries++,t.retries>o&&(o=t.retries),this.ri.unshift(t)});break;case 6:ht.S(`Op failed, pausing: ${JSON.stringify(n)}`),this.ns(),t.forEach(t=>t.resolver?.(!1)),[...t].reverse().forEach(t=>{xs(t.operation),this.ri.unshift(t)})}if(s.Wi)for(const t of[...s.Wi].reverse()){const e={operation:t,bucket:0,retries:0};this.ri.unshift(e),this.Yn.Ln(0,e.operation)}await this.us(o,s.qi),s.en&&await ut(500)}catch(e){ht.S(`Op execute error: ${JSON.stringify(t)}`,e),t.forEach(t=>{this.Yn.wn(t.operation.Ce)}),t.forEach(t=>t.resolver?.(!1))}}async us(t,e){ht.p(`retryAfterSeconds: ${e}`);const i=1e3*(e||0),n=1e3*t,s=Math.max(n,i);s<1||(ht.S(`Ops delayed: ${s}ms`),await ut(s))}cs(t){const e=this.ri.findIndex(e=>e.operation.Ke&&this.Vi.qn(e.operation.Be)&&e.bucket<=t);if(-1!==e){const t=this.ri[e];return this.ri.splice(e,1),this.ds(t)}return null}ds(t){const e=[t];if(2===t.operation.ze)return e;const i=0===t.operation.ze?t.operation.je:t.operation.Je,n=[...this.ri];for(const s of n){const n=0===t.operation.ze?s.operation.je:s.operation.Je;if(""===n&&""===i)throw new Error("Both comparison keys cannot be blank!");if(this.Vi.qn(s.operation.Be)&&n===i){const t=this.ri.indexOf(s);-1!==t&&(this.ri.splice(t,1),e.push(s))}}return e}async ts(){await this.Yn.Bn();const t=[...this.Yn.li()].reverse();for(const e of t)this.ss({operation:e,bucket:this.Gn,retries:0},!1,0)}},Es=class{Yn;ci;hs;ui;Li;Qi;oi;gs;ps;fs;constructor(){this.hs=new ks,this.Yn=new bs,this.Li=new vs,this.Qi=new Os,this.ui=new Is,this.ps=new ms(this.Li,this.Qi,this.ui),this.fs=this.ws(),this.ci=new Cs(this.fs,this.Yn,this.hs),this.oi=new Wn(this.Li,this.ci),this._s(),this.gs=this.ci.Xn()}async bs(){return Ue("CoreModule.init"),this.gs}_s(){return this.ci?[new gs(this.Li,this.ci),new ps(this.Qi,this.ci),new ws(this.ui,this.ci,this.Li)]:[]}ws(){const t=new qn(this.Li,this.ps,this.hs);return[t,new ts(t,this.Li,this.Qi,this.ui),new rs(this.Li,this.Qi,this.ui,this.ps,this.hs),new cs(this.ui,this.ps,this.hs),new us(this.Li,this.Qi,this.ps,this.hs),new jn]}},Ps=class{type;token;enabled;notificationTypes;sdk;deviceModel;deviceOs;webAuth;webp256;constructor(t){this.token=this.ys(t),this.type=U(),this.enabled=!0,this.notificationTypes=1,this.sdk=C,this.deviceModel=L(),this.deviceOs=D(),this.webAuth=t.w3cAuth,this.webp256=t.w3cP256dh}ys(t){return t.w3cEndpoint?t.w3cEndpoint.toString():t.safariDeviceToken}I(){return{type:this.type,token:this.token,enabled:this.enabled,notification_types:this.notificationTypes,sdk:this.sdk,device_model:this.deviceModel,device_os:this.deviceOs,web_auth:this.webAuth,web_p256:this.webp256}}},$s=class{Ss;constructor(t){this.Ss=t}get ci(){return this.Ss.ci}get Li(){return this.Ss.Li}get Qi(){return this.Ss.Qi}get ui(){return this.Ss.ui}get hs(){return this.Ss.hs}get oi(){return this.Ss.oi}vs(t){Ue("CoreModuleDirector.generatePushSubscriptionModel",{rawPushSubscription:t});const e=new _n;return e.$e(new Ps(t).I()),e.id=hn.ge(),this.Ss.ui.Mn(e,2),e}hi(t){this.Ss.ui.Mn(t)}ei(t){this.Ss.ui.wn(t)}ti(){return Ue("CoreModuleDirector.getEmailSubscriptionModels"),this.Ss.ui.li().filter(t=>t.type===l)}Os(){const t=this.ti();return Object.keys(t).length>0}ii(){return Ue("CoreModuleDirector.getSmsSubscriptionModels"),this.Ss.ui.li().filter(t=>"SMS"===t.type)}Is(){const t=this.ii();return Object.keys(t).length>0}ks(){return Ue("CoreModuleDirector.getAllPushSubscriptionModels"),this.Ss.ui.li().filter(t=>Un(t.type))}async xs(){Ue("CoreModuleDirector.getPushSubscriptionModelByCurrentToken");const t=await qe();if(t)return this.Cs(r,t)}async Es(){Ue("CoreModuleDirector.getPushSubscriptionModelByLastKnownToken");const t=await(async()=>await ee("lastPushToken"))()??"";if(null!==t)return this.Cs(r,t)}async me(){Ue("CoreModuleDirector.getPushSubscriptionModel");const t=await this.Es();return await this.xs()||t}Qe(){return Ue("CoreModuleDirector.getIdentityModel"),this.Ss.Li.Ri}Ze(){return Ue("CoreModuleDirector.getPropertiesModel"),this.Ss.Qi.Ri}async Ps(){Ue("CoreModuleDirector.getAllSubscriptionsModels");const t=this.ti(),e=this.ii(),i=await this.me();return[...t,...e,...i?[i]:[]]}Cs(t,e){let i;switch(Ue("CoreModuleDirector.getSubscriptionOfTypeWithToken",{type:t,token:e}),t){case"Email":i=this.ti();break;case"SMS":i=this.ii();break;case r:i=this.ks();break;default:return}return i.find(t=>t.token===e)}},Ts=class t{static $s=Promise.resolve();static async login(e,i){await(this.$s=t.Ts(e,i))}static async Ts(e,i){i&&te.put("Ids",{id:i,type:"jwtToken"});const n=OneSignal.ye.Qe(),s=hn.pe(n.Fe)?void 0:n.Fe,a=n.qe;if(a===e)return void ht.p("Login: externalId already set");const o=t.Ns();o.Ne(J,e,2),await t.As(o.Fe,e,a?void 0:s,!0)}static async logout(){await(this.$s=t.Ms())}static async Ms(){if(!OneSignal.ye.Qe().qe)return ht.p("Logout: not logged in");const e=t.Ns();await t.As(e.Fe)}static Ns(){const t=new as,e=new os,i=hn.ge();return t.Fe=i,e.Fe=i,OneSignal.ye.Li.un(t),OneSignal.ye.Qi.un(e),OneSignal.ye.Qe()}static async As(t,e,i,n=!1){const s=Ve();await Promise.all([OneSignal.ye.me().then(e=>{if(e)OneSignal.ye.ci.di(new Zn(s,t,e.id));else if(n){const e=new _n;e.Le({enabled:!0,id:hn.ge(),onesignalId:t,type:U(),token:""}),OneSignal.ye.ui.Mn(e)}}),OneSignal.ye.ci.rs(new mn(s,t,e,i))])}};function Ns(t){const e=t.active||t.installing||t.waiting;return e||ht.m("No available SW instance"),e}var As=class{Us;constructor(){this.Us={}}Ds(t,e,i){const n={callback:e,onceListenerOnly:i},s=this.Us[t.toString()];s?s.push(n):this.Us[t.toString()]=[n]}Ls(t){return this.Us[t.toString()]||[]}Fs(t){this.Us[t.toString()]=null}Rs(){this.Us={}}Ws(t,e){const i=this.Us[t.toString()];if(null!=i)for(let n=i.length-1;n>=0;n--)i[n]===e&&i.splice(n,1)}},Ms=class{M;Us;constructor(t,e=new As){this.M=t,this.Us=e}Bs(t,e){this.Us.Ds(t,e,!1)}js(t,e){this.Us.Ds(t,e,!0)}zs(t){t?this.Us.Fs(t):this.Us.Rs()}},Us=class extends Ms{Ks(){$()&&this.Vs()}Vs(){navigator.serviceWorker.addEventListener("message",this.qs.bind(this)),ht.p(`[WM] Page listening (${location.origin})`)}qs(t){const e=t.data;if(!e||!e.command)return;const i=this.Us.Ls(e.command),n=[],s=[];ht.p("[WM] Page received:",t.data);for(const a of i)a.onceListenerOnly&&n.push(a),s.push(a);for(let a=n.length-1;a>=0;a--){const t=n[a];this.Us.Ws(e.command,t)}for(const a of s)a.callback.apply(null,[e.payload])}Hs(t,e){ht.p(`[WM] Page->SW unicast '${t}'`),this.Js(t,e)}async Js(t,e){ht.p(`[WM] Page->SW direct '${t}'`);const i=await(this.M?.D.Gs());if(!i)return void ht.S("[WM] No SW registration for postMessage");const n=Ns(i);n?n.postMessage({command:t,payload:e}):ht.S("[WM] No SW for postMessage")}},Ds=class{Ys;Gt;We;Qs;constructor(t,e,i,n){this.Ys=i,this.Gt=e,this.We=t,this.Qs=n}async Zs(){return await async function(t){if(t.direct&&t.direct.enabled){const t=await(async()=>(await te.getAll("Outcomes.NotificationClicked")).map(t=>{return{appId:(e=t).appId,notificationId:e.notificationId,timestamp:e.timestamp};var e}))();if(t.length>0)return{type:1,notificationIds:[t[0].notificationId]}}if(t.indirect&&t.indirect.enabled){const e=60*t.indirect.influencedTimePeriodMin*1e3,i=new Date((new Date).getTime()-e).getTime(),n=await(async()=>(await te.getAll("Outcomes.NotificationReceived")).map(t=>{return{appId:(e=t).appId,notificationId:e.notificationId,timestamp:e.timestamp};var e}))();if(ht.p(`${n.length} received notifs found`),n.length>0){const e=t.indirect.influencedNotificationsLimit,s=n.slice().sort((t,e)=>e.timestamp-t.timestamp),a=s.filter(t=>t.timestamp>=i).slice(0,e).map(t=>t.notificationId);ht.p(`${a.length} notifs in reporting window`);const o=s.filter(t=>-1===a.indexOf(t.notificationId)).map(t=>t.notificationId);if(o.forEach(t=>te.delete("Outcomes.NotificationReceived",t)),ht.p(`${o.length} notifs to delete`),a.length>0)return{type:2,notificationIds:a}}}return t.unattributed&&t.unattributed.enabled?{type:3,notificationIds:[]}:{type:4,notificationIds:[]}}(this.Gt)}async Xs(){return Ue(this.Qs?"sendUniqueOutcome":"sendOutcome",this.Ys),this.Gt?this.Ys?(await Me(),!!(await OneSignal.M.gt.ht())||(ht.m("Outcomes require subscription"),!1)):(ht.S("Outcome name is required"),!1):(ht.p("Outcomes not supported yet"),!1)}async ta(){return(await te.getAll("SentUniqueOutcome")).filter(t=>t.outcomeName===this.Ys).reduce((t,e)=>[...t,...e.notificationIds||[]],[])}async ea(t){const e=await this.ta();return t.filter(t=>-1===e.indexOf(t))}ia(t,e){return 3===t.type||e.length>0}async na(t){const e=this.Ys,i=await te.get("SentUniqueOutcome",e),n=await ne(),s=[...i?i.notificationIds:[],...t],a=n?n.startTimestamp:null;await te.put("SentUniqueOutcome",{outcomeName:e,notificationIds:s,sentDuringSession:a})}async sa(){const t=await te.get("SentUniqueOutcome",this.Ys);if(!t)return!1;const e=await ne(),i=e&&t.sentDuringSession===e.startTimestamp,n=!e&&!!t.sentDuringSession;return i||n}async aa(t){const{type:e,notificationIds:i,weight:n}=t;switch(e){case 1:return this.Qs&&await this.na(i),void(await OneSignal.M.Mi.oa(this.We,i,this.Ys,n));case 2:return this.Qs&&await this.na(i),void(await OneSignal.M.Mi.ra(this.We,i,this.Ys,n));case 3:if(this.Qs){if(await this.sa())return void ht.m("Unattributed unique outcome already sent this session");await this.na([])}return void(await OneSignal.M.Mi.ca(this.We,this.Ys,n));default:return void ht.m("Upgrade required for this functionality")}}};function Ls(t,e,i){return function(t,e,i){return`${new URL(t,dt()).href}?${yt({appId:e})}&${yt({sdkVersion:i})}`}(t.workerPath.la(),e,i)}var Fs="OneSignal Worker",Rs="3rd Party",Ws="None",Bs="GetWorkerVersion",js="os.session.deactivate",zs=class{ua;constructor(t){if(!t)throw st("path");this.ua=t.trim()}da(){return this.ua.split("?")[0]}ha(){return this.da().split("\\").pop()?.split("/").pop()}la(){return this.ua}},Ks=class t{M;Gt;constructor(t,e){this.M=t,this.Gt=e}async U(){return async function(t){try{const e=location.origin+t;return await navigator.serviceWorker.getRegistration(e)}catch(e){return void ht.m("SW registration check error",t,e)}}(this.Gt.registrationOptions.scope)}async Gs(){if(await this.ga()===Fs)return this.U()}async ga(){const e=await this.U();if(!e)return Ws;const i=t.pa(e);return this.fa(i)}static pa(t){const e=Ns(t);if(!e)return null;const i=new URL(e.scriptURL).pathname,n=new zs(i).ha();if("akam-sw.js"==n){const t=new URLSearchParams(new URL(e.scriptURL).search).get("othersw");if(t)return ht.p("Found SW under akam-sw.js?othersw=",t),new zs(new URL(t).pathname).ha()}return n}fa(t){return t?t==this.Gt.workerPath.ha()?Fs:Rs:Ws}async wa(){return new Promise(t=>{this.M._a.js(Bs,e=>{t(e)}),this.M._a.Hs(Bs)})}async ba(){if(!$())return!1;if(!OneSignal.config)return!1;const t=await this.ga();if(ht.p("shouldInstallWorker state:",t),t===Ws||t===Rs){const t="granted"===OneSignal.M.A.ki(OneSignal.config.safariWebId);return t&&ht._("Permissions enabled, installing SW"),t}return!!(await this.ma())||this.ya()}async ma(){const t=await this.U();if(!t)return ht._("SW registration not found at scope",this.Gt.registrationOptions.scope),!0;const e=new URL(t.scope).pathname,i=this.Gt.registrationOptions.scope;if(e!=i)return ht._("SW scope changing",{a_old:e,b_new:i}),!0;const n=Ns(t),s=Ls(this.Gt,this.M._i.appId,C);return!n?.scriptURL||s!==n.scriptURL&&(ht._("SW href changing:",{a_old:n?.scriptURL,b_new:s}),!0)}async ya(){let t;ht._("Checking SW version...");try{t=await function(t){const e=new Promise((t,e)=>{setTimeout(()=>{e(new Error("Async operation timed out"))},2e3)});return Promise.race([t,e])}(this.wa())}catch{return ht._("SW did not reply to version query, updating"),!0}return"160610"!==t?(ht._(`Updating SW ${t} -> ${C}`),!0):(ht._(`SW version current: ${t}`),!1)}xi(){ht.p("establishSWChannel");const t=this.M._a;t.zs(),t.Bs("notification.willDisplay",e=>{ht.p(location.origin,"Notif display event from SW");let i=!1;const n=e.notification.notificationId,s={notification:{...e.notification,display:()=>{ht.p(`display() called: ${n}`),t.Hs("notification.display",{notification:e.notification})}},preventDefault:function(){ht.p(`preventDefault() called: ${n}`),i=!0}};Re.$(OneSignal.EVENTS.NOTIFICATION_WILL_DISPLAY,s),ht.p(`preventDefault response: ${i} for: ${n}`),t.Hs("notification.willDisplay.response",{notificationId:n,preventDefault:i})}),t.Bs("notification.clicked",t=>{0===OneSignal.P.he(OneSignal.EVENTS.NOTIFICATION_CLICKED)?ht.p("Click event with no listeners, storing for later"):function(t){const e={notification:t.notification,result:t.result};Re.$(OneSignal.EVENTS.NOTIFICATION_CLICKED,e)}(t)}),t.Bs("notification.dismissed",t=>{Re.$(OneSignal.EVENTS.NOTIFICATION_DISMISSED,t)});const e=P();t.Bs("os.page_focused_request",async i=>{if(e){const e={timestamp:i.timestamp,focused:document.hasFocus()};await t.Js("os.page_focused_response",e)}})}async Sa(){if(!(await this.ba()))return this.Gs();ht._("Installing worker..."),await this.ga()===Rs&&ht._("3rd party SW detected");const t=Ls(this.Gt,this.M._i.appId,C),e=`${dt()}${this.Gt.registrationOptions.scope}`;ht._(`Installing SW ${t} ${e}`);const i=await navigator.serviceWorker.register(t,{scope:e,type:void 0});return ht.p("SW installed, waiting for activation"),await function(t){return new Promise(e=>{const i=t.installing||t.waiting;i&&i.addEventListener("statechange",()=>{ht.p("SW state:",i.state),t.active&&e()}),t.active&&e()})}(i),ht.p("SW active"),this.xi(),i}},Vs=class t{w3cEndpoint;w3cP256dh;w3cAuth;safariDeviceToken;static va(e){const i=new t;if(e&&(i.w3cEndpoint=new URL(e.endpoint),e.getKey)){let t=null;try{t=e.getKey("p256dh")}catch{}let n=null;try{n=e.getKey("auth")}catch{}t&&(i.w3cP256dh=btoa(String.fromCharCode(...new Uint8Array(t)))),n&&(i.w3cAuth=btoa(String.fromCharCode(...new Uint8Array(n))))}return i}Oa(t){t&&(this.safariDeviceToken=t)}I(){return{w3cEndpoint:this.w3cEndpoint?this.w3cEndpoint.toString():null,w3cP256dh:this.w3cP256dh,w3cAuth:this.w3cAuth,safariDeviceToken:this.safariDeviceToken}}static k(e){const i=new t;if(!e)return i;try{i.w3cEndpoint=new URL(e.w3cEndpoint)}catch{}return i.w3cP256dh=e.w3cP256dh,i.w3cAuth=e.w3cAuth,i.safariDeviceToken=e.safariDeviceToken,i}},qs=class t{M;Gt;constructor(t,e){this.M=t,this.Gt=e}async Si(t,e){t&&(t=Vs.k(t)),await this.$i()?"Mi"in this.M&&await this.M.Mi.Ia():"Ni"in this.M&&this.M.Ni.ka(1);const i=await fe();return i.deviceId="99999999-9999-9999-9999-999999999999",i.optedOut=!1,t?N()?i.subscriptionToken=t.safariDeviceToken:i.subscriptionToken=t.w3cEndpoint?t.w3cEndpoint.toString():null:i.subscriptionToken=null,await we(i),Re.$(OneSignal.EVENTS.REGISTERED),"undefined"!=typeof OneSignal&&(OneSignal.Oi=!1),i}async $i(){const{deviceId:t}=await fe();return!!t}async xa(e,i){const n=await e.getSubscription();switch(i){case sn.re:if(!n)break;n.options?ht.p("Existing push sub options present"):(ht.p("Existing push sub options null, unsubscribing first"),await t.Ca(n));break;case sn.ce:n&&await t.Ca(n)}const[s,a]=await t.Ea(e,this.Pa());return await t.$a(a,s.expirationTime),Vs.va(s)}Pa(){let t;return t=I()===w?this.Gt.onesignalVapidPublicKey:this.Gt.vapidPublicKey,t?function(t){const e=(t+"=".repeat((4-t.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/"),i=atob(e),n=new Uint8Array(i.length);for(let s=0;s{await Ts.$s;let e=await OneSignal.ye.me();if(!e)return e=OneSignal.ye.vs(t),Js(e);if(hn.pe(e.id))return Js(e);const i=new Ps(t).I();for(const n in i){const t=n;e.Ne(t,i[t])}},Ys=class t extends qs{Ta=!1;async ht(){const t=await this.Na();return t.subscribed&&!t.optedOut}async fi(){const t=await this.Aa();await this.Ma(t)}async Ma(t){const e=await OneSignal.ye.me();e?(e.Re=t,e.enabled=1===t):ht._("No push sub to update notification_types")}async Aa(){const{optedOut:t}=await fe();return t?-2:"granted"===await OneSignal.M.A.N()?1:0}async pi(){const t=await this.Na();return"granted"===await OneSignal.M.A.N()&&!t.optedOut}async Ii(t){Ue("isOptedOut",t);const{optedOut:e}=await fe();return function(t,...e){t&&t.apply(null,e)}(t,e),e}ke(t){throw Hs}async Na(){const{optedOut:t,subscriptionToken:e}=await fe(),i=gn(await OneSignal.ye.me());if(N()){const n=window.safari?.pushNotification?.permission(this.Gt.safariWebId);return{subscribed:!!(i&&e&&"granted"===n?.permission&&n?.deviceToken),optedOut:!!t}}const n=await this.M.D.Gs(),s=this.M.A.ki(this.M._i.safariWebId);return n?{subscribed:!(!i||!e||"granted"!==s),optedOut:!!t}:{subscribed:!1,optedOut:!!t}}async Ie(t){let e;if("denied"===await OneSignal.M.A.N())throw tt;if(N()){e=await this.Ua(),await Gs(e),ht._("Installing SW on Safari");try{await this.M.D.Sa(),ht._("Safari SW installed")}catch{ht.S("Safari SW install failed")}}else e=await this.Da(t),await Gs(e);return e}async Ua(){const t=new Vs;if(!this.Gt.safariWebId)throw it;const{deviceToken:e}=window.safari?.pushNotification?.permission(this.Gt.safariWebId)||{};if(e)return t.Oa(e.toLowerCase()),t;Re.$(OneSignal.EVENTS.PERMISSION_PROMPT_DISPLAYED);const i=await this.La();if(Be(),!i)throw this.Ta=!0,new Error("Safari url/icon/certificate invalid or in private mode");return t.Oa(i),t}async La(){const t=t=>new Promise(e=>{window.safari?.pushNotification?.requestPermission(t,this.Gt.safariWebId,{app_id:this.Gt.appId},t=>{t&&t.deviceToken?e(t.deviceToken.toLowerCase()):e(null)})});return this.Ta?t(`${M({legacy:!0}).toString()}safari`):t(`${M({legacy:!0}).toString()}safari/apps/${this.Gt.appId}`)}async Da(e){if("default"===Notification.permission){Re.$(OneSignal.EVENTS.PERMISSION_PROMPT_DISPLAYED);const e=await t.Fa();switch(await Be("default"===e),e){case"default":throw ht.p("Permission dismissed, exiting subscription"),OneSignal.Oi=!1,new Error("Permission dismissed");case"denied":throw ht.p("Permission blocked, exiting subscription"),OneSignal.Oi=!1,tt}}let i;try{i=await this.M.D.Sa()}catch(n){throw n instanceof Y&&(403===n.status?this.M.gt.Ra(-23):404===n.status&&this.M.gt.Ra(-24)),n}if(!i)throw new Error("OneSignal service worker not found!");return ht.p("SW ready, continuing subscription"),await this.xa(i.pushManager,e)}Ra(t){ln()&&(this.M.gt.Si(new Vs,t),cn())}static async Fa(){return await t.Wa()}static async Wa(){return await window.Notification.requestPermission()}async Pi(){if(await this.M.D.ga()!==Fs)return!1;const t=await this.M.D.Gs();if(!t)return!1;if(!t.pushManager)return!1;const e=await t.pushManager.getSubscription();if(!e)return!1;if(!e.expirationTime)return!1;let{createdAt:i}=await fe();i||(i=(new Date).getTime()+31536e6);const n=i+(e.expirationTime-i)/2;return!!e.expirationTime&&((new Date).getTime()>=e.expirationTime||(new Date).getTime()>=n)}},Qs=class t{N(){return OneSignal.M?Promise.resolve(OneSignal.M.A.ki(OneSignal.config.safariWebId)):Promise.reject(new Error("OneSignal.context is undefined. Call init first"))}ki(e){return N()?t.Ba(e):this.ja()}static Ba(t){if(t)return window.safari?.pushNotification?.permission(t).permission;throw st("safariWebId")}ja(){return Notification.permission}},Zs=class{M;za=!1;constructor(t){this.M=t}Ka(t,e,i){const n={onesignalId:t,subscriptionId:e,appId:this.M._i.appId,sessionThreshold:this.M._i.sessionThreshold||0,enableSessionDuration:!!this.M._i.enableSessionDuration,sessionOrigin:i,isSafari:P(),outcomesConfig:this.M._i.userConfig.outcomes};return $()?(ht.p("SW upsert session"),this.M._a.Hs("os.session.upsert",n)):ht.p("Upsert: no-op"),Promise.resolve()}Va(t,e,i){const n={appId:this.M._i.appId,subscriptionId:e,onesignalId:t,sessionThreshold:this.M._i.sessionThreshold,enableSessionDuration:this.M._i.enableSessionDuration,sessionOrigin:i,isSafari:P(),outcomesConfig:this.M._i.userConfig.outcomes};return $()?(ht.p("SW deactivate session"),this.M._a.Hs(js,n)):ht.p("Deactivate: no-op"),Promise.resolve()}async qa(){const t=OneSignal.ye.Qe(),e=await OneSignal.ye.me();if(!t||!t.Fe)throw new Error("No identity");if(!e||!gn(e))throw new Error("No subscription");const{Fe:i}=t,{id:n}=e;return{onesignalId:i,subscriptionId:n}}async Ha(){if(await Ts.$s,yn.Ge?.onesignalId)try{const t=document.visibilityState,{onesignalId:e,subscriptionId:i}=await this.qa();if("visible"===t)return this.Ja(),ht.p("handleVisibilityChange","visible",`hasFocus: ${document.hasFocus()}`),void(document.hasFocus()&&await this.Ka(e,i,3));if("hidden"===t)return ht.p("handleVisibilityChange","hidden"),OneSignal.L.focusHandler&&OneSignal.L.isFocusEventSetup&&(window.removeEventListener("focus",OneSignal.L.focusHandler,!0),OneSignal.L.isFocusEventSetup=!1),OneSignal.L.blurHandler&&OneSignal.L.isBlurEventSetup&&(window.removeEventListener("blur",OneSignal.L.blurHandler,!0),OneSignal.L.isBlurEventSetup=!1),void(await this.Va(e,i,4));ht.m("Unhandled visibility state",t)}catch(t){ht.S("Visibility change error:",t)}}async Ga(){if(await Ts.$s,yn.Ge?.onesignalId)try{const{onesignalId:t,subscriptionId:e}=await this.qa(),i={appId:this.M._i.appId,onesignalId:t,subscriptionId:e,sessionThreshold:this.M._i.sessionThreshold,enableSessionDuration:this.M._i.enableSessionDuration,sessionOrigin:5,isSafari:P(),outcomesConfig:this.M._i.userConfig.outcomes};ht.p("SW deactivate (beforeunload)"),this.M._a.Js(js,i)}catch(t){ht.S("beforeunload error:",t)}}async Ya(t){if(await Ts.$s,ht.p("handleOnFocus",t),yn.Ge?.onesignalId)try{if(t.target!==window)return;const{onesignalId:e,subscriptionId:i}=await this.qa();await this.Ka(e,i,7)}catch(t){ht.S("Focus error:",t)}}async Qa(t){if(await Ts.$s,ht.p("handleOnBlur",t),yn.Ge?.onesignalId)try{if(t.target!==window)return;const{onesignalId:e,subscriptionId:i}=await this.qa();await this.Va(e,i,8)}catch(t){ht.S("Blur error:",t)}}async ka(t){if(await Ts.$s,yn.Ge?.onesignalId){const{onesignalId:e,subscriptionId:i}=await this.qa();await this.Ka(e,i,t)}$()?this.Ti():OneSignal.P.T(OneSignal.EVENTS.SESSION_STARTED)}Ti(){$()?(this.Ja(),OneSignal.L.isVisibilityChangeEventSetup||(document.addEventListener("visibilitychange",this.Ha.bind(this),!0),OneSignal.L.isVisibilityChangeEventSetup=!0),OneSignal.L.isBeforeUnloadEventSetup||(window.addEventListener("beforeunload",t=>{this.Ga(),delete t.returnValue},!0),OneSignal.L.isBeforeUnloadEventSetup=!0)):ht.p("No SW support, skipping session listeners")}Ja(){ht.p("setupOnFocusAndOnBlurForSession"),OneSignal.L.focusHandler||(OneSignal.L.focusHandler=this.Ya.bind(this)),OneSignal.L.isFocusEventSetup||(window.addEventListener("focus",OneSignal.L.focusHandler,!0),OneSignal.L.isFocusEventSetup=!0),OneSignal.L.blurHandler||(OneSignal.L.blurHandler=this.Qa.bind(this)),OneSignal.L.isBlurEventSetup||(window.addEventListener("blur",OneSignal.L.blurHandler,!0),OneSignal.L.isBlurEventSetup=!0)}async Za(){if(this.za||!ln())return;const t=OneSignal.ye.Qe().Fe;if(!t)return void ht.p("No onesignal id, skipping on_session");const e=await OneSignal.ye.me();if(1!==e?.Re&&!0!==OneSignal.config?.enableOnSession)return;let i;gn(e)&&(i=e?.id);try{const e={label:G,id:t},s={refresh_device_metadata:!0,deltas:{session_count:1}},a=Ve();(function(t){if(!t)throw new Error("App id cannot be empty")})(a),function(t){if(!t.label)throw new Error("Alias label cannot be empty");if(!t.id)throw new Error("Alias id cannot be empty")}(e);try{await mt({appId:a,subscriptionId:i},e,s),this.za=!0}catch(n){ht.p("Session update error:",n)}}catch(n){n instanceof Error&&ht.S(`Session update failed: "${n.message}" ${n.stack}`)}}},Xs=class{M;za;constructor(t){this.M=t,this.za=rn()>1}async Ia(){yn.Ge?.onesignalId?this.za||await this.Ai():ht.p("Update skipped: no onesignal_id")}async Ai(){if(!this.za&&ln())if(await this.M.gt.$i()){if(1===(await OneSignal.ye.me())?.Re||!0===OneSignal.config?.enableOnSession)try{this.M.Ni.ka(2),this.za=!0}catch(t){t instanceof Error&&ht.S(`Session update failed: ${t.message}`,t.stack)}}else ht.p("On session skipped: no device id")}async oa(t,e,i,n){Ue("sendOutcomeDirect");const s=await OneSignal.ye.me();if(s&&gn(s)){const a={id:i,app_id:t,notification_ids:e,direct:!0,subscription:{id:s.id,type:U()}};return void 0!==n&&(a.weight=n),void(await St(a))}ht.m("Outcome aborted: no push sub model")}async ra(t,e,i,n){Ue("sendOutcomeInfluenced");const s=await OneSignal.ye.me();if(s&&gn(s)){const a={id:i,app_id:t,notification_ids:e,direct:!1,subscription:{id:s.id,type:U()}};return void 0!==n&&(a.weight=n),void(await St(a))}ht.m("Outcome aborted: no push sub model")}async ca(t,e,i){Ue("sendOutcomeUnattributed");const n=await OneSignal.ye.me();if(n&&gn(n)){const s={id:e,app_id:t,subscription:{id:n.id,type:U()}};return void 0!==i&&(s.weight=i),void(await St(s))}ht.m("Outcome aborted: no push sub model")}},ta=class t{Xa=!0;eo=!0;io;no;constructor(t){this.io=t}so(){const t=document.createElement("div");let e,i,n;switch(Se(t,Bi),t.id=Bi,this.io.type){case Et:e=this.io.text.smsLabel||"Phone Number",i=this.ao(Et,e),t.appendChild(i);break;case Pt:e=this.io.text.emailLabel||"Email",n=this.ao(Pt,e),t.appendChild(n);break;case $t:e=this.io.text.emailLabel||"Email",n=this.ao(Pt,e),t.appendChild(n),e=this.io.text.smsLabel||"Phone Number",i=this.ao(Et,e),t.appendChild(i)}return t}oo(t){const e=document.createElement("div"),i=document.createElement("img"),n=document.createElement("p");return n.innerText=t,i.setAttribute("src","data:image/svg+xml;charset=UTF-8,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M7.98775 -0.00114406C5.85015 0.0338508 3.81219 0.908665 2.31442 2.43419C1.565 3.18031 0.973715 4.06987 0.575897 5.04969C0.17808 6.02952 -0.0180997 7.07949 -0.000914196 8.13686C-0.00214385 9.17005 0.200528 10.1933 0.595487 11.148C0.990446 12.1028 1.56993 12.9702 2.30072 13.7005C3.03151 14.4309 3.89925 15.0098 4.85421 15.4042C5.80916 15.7986 6.83256 16.0007 7.86575 15.9989H8.00842C10.1467 15.9769 12.1889 15.1075 13.6869 13.5816C15.185 12.0557 16.0165 9.99781 15.9991 7.85952C16.0015 6.8138 15.7949 5.77814 15.3913 4.81345C14.9876 3.84876 14.3952 2.97451 13.6488 2.24213C12.9023 1.50974 12.017 0.933994 11.0448 0.548751C10.0726 0.163508 9.03324 -0.0234551 7.98775 -0.00114406ZM6.99909 11.0269C6.99428 10.8961 7.01558 10.7658 7.06175 10.6434C7.10792 10.521 7.17803 10.4091 7.26797 10.3141C7.35792 10.2191 7.4659 10.143 7.58559 10.0903C7.70529 10.0375 7.8343 10.0092 7.96509 10.0069H7.98309C8.24616 10.0074 8.49882 10.1097 8.6881 10.2924C8.87739 10.4751 8.9886 10.724 8.99842 10.9869C9.00331 11.1176 8.98207 11.248 8.93594 11.3704C8.8898 11.4928 8.8197 11.6048 8.72974 11.6998C8.63978 11.7948 8.53176 11.8709 8.41202 11.9236C8.29229 11.9763 8.16323 12.0046 8.03242 12.0069H8.01442C7.75145 12.006 7.49897 11.9036 7.30976 11.721C7.12054 11.5383 7.00923 11.2896 6.99909 11.0269ZM7.33242 8.33219V4.33219C7.33242 4.15538 7.40266 3.98581 7.52768 3.86079C7.65271 3.73576 7.82227 3.66552 7.99909 3.66552C8.1759 3.66552 8.34547 3.73576 8.47049 3.86079C8.59551 3.98581 8.66575 4.15538 8.66575 4.33219V8.33219C8.66575 8.509 8.59551 8.67857 8.47049 8.80359C8.34547 8.92862 8.1759 8.99886 7.99909 8.99886C7.82227 8.99886 7.65271 8.92862 7.52768 8.80359C7.40266 8.67857 7.33242 8.509 7.33242 8.33219Z' fill='%23E54B4D'/%3e%3c/svg%3e"),e.appendChild(i),e.appendChild(n),e}ao(t,e){const i=this.ro(t),n=document.createElement("label"),s=document.createElement("input"),a=document.createElement("div"),o=document.createElement("div"),r=this.oo(i.message),c=document.createElement("div");return a.setAttribute("style","clear:both"),o.setAttribute("style","clear:both"),Se(r,zi),Se(r,"onesignal-validation-element"),r.id=i.validationElementId,n.title=e,n.innerText=e,n.htmlFor=i.inputElementId,s.type=i.domElementType,s.id=i.inputElementId,s.tabIndex=i.tabIndex,Se(s,i.inputClass),Se(c,"input-with-validation-element"),c.id=i.wrappingDivId,c.appendChild(n),c.appendChild(a),c.appendChild(s),c.appendChild(o),c.appendChild(r),c}ro(t){if(t===Pt)return{message:"Please enter a valid email",domElementType:"email",validationElementId:Gi,inputElementId:Hi,inputClass:"onesignal-email-input",wrappingDivId:Vi,tabIndex:1};if(t===Et)return{message:"Please enter a valid phone number",domElementType:"tel",validationElementId:Ji,inputElementId:qi,inputClass:"iti-onesignal-sms-input",wrappingDivId:Ki,tabIndex:2};throw new Error("invalid channel type for input validation")}co(){const t=ye(`#${qi}`);t&&window.intlTelInput?this.no=window.intlTelInput(t,{autoPlaceholder:"off",separateDialCode:!0}):ht.S("Failed to init phone input library")}lo(){const t=ye(`#${qi}`);t.addEventListener("keyup",e=>{this.Xa=this.no?.isValidNumber()||""===t?.value,"Enter"===e.key&&document.getElementById(Pi)?.click(),this.uo()}),t.addEventListener("blur",()=>{this.Xa=this.no?.isValidNumber()||""===t?.value,this.uo()})}do(){const e=ye(`#${Hi}`);e.addEventListener("keyup",i=>{const n=e?.value;this.eo=t.ho(n),"Enter"===i.key&&document.getElementById(Pi)?.click(),this.po()})}uo(){const t=ye(`#${Ki}`),e=ye(`#${Ji}`);ve(t,ji),Se(e,zi)}po(){const t=ye(`#${Vi}`),e=ye(`#${Gi}`);ve(t,ji),Se(e,zi)}async fo(){if(OneSignal.wo)return;const t=document.createElement("script"),e=document.createElement("script"),i=document.createElement("link");t.src="https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.12/js/intlTelInput.min.js",e.src="https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.12/js/utils.js",i.href="https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.12/css/intlTelInput.min.css",i.rel="stylesheet",t.integrity="sha512-OnkjbJ4TwPpgSmjXACCb5J4cJwi880VRe+vWpPDlr8M38/L3slN5uUAeOeWU2jN+4vN0gImCXFGdJmc0wO4Mig==",e.integrity="sha512-bUcJxlqkiGA3cmoYPuZaLRsyc5ChG9APG4ajom2AXKSlBtOmx4kLV3c8uv/6uSz43FMjI4Q2QI21+D223rT76w==",i.integrity="sha512-yye/u0ehQsrVrfSd6biT17t39Rg9kNc+vENcCXZuMz2a+LWFGvXUnYuWUW6pbfYj1jcBb/C39UZw2ciQvwDDvg==",t.crossOrigin="anonymous",e.crossOrigin="anonymous",i.crossOrigin="anonymous",document.head.appendChild(t),document.head.appendChild(e),document.head.appendChild(i);const n=new Promise(e=>{t.onload=()=>{e()}}),s=new Promise(t=>{e.onload=()=>{t()}});await Promise.all([n,s]),OneSignal.wo=!0}async _o(){const e=t.bo(this.io.type),i=t.mo(this.io.type);e&&await this.fo();const n=this.so();ye(`#${$i}`).appendChild(n),e&&(this.co(),this.lo()),i&&this.do()}yo(){return""===this.So()}vo(){return""===this.Oo()}So(){return ye(`#${Hi}`)?.value||""}Oo(){return this.no?.getNumber(window.intlTelInputUtils?.numberFormat.E164)||""}static Io(t){const e=document.querySelector(`#${Ji}`),i=document.querySelector(`#${Ki}`);e&&i?t?(e.classList.remove(zi),i.classList.add(ji)):(e.classList.add(zi),i.classList.remove(ji)):ht.S("Missing validation element")}static ko(t){const e=document.querySelector(`#${Gi}`),i=document.querySelector(`#${Vi}`);e&&i?t?(e.classList.remove(zi),i.classList.add(ji)):(e.classList.add(zi),i.classList.remove(ji)):ht.S("Missing validation element")}static xo(e){switch(e){case Et:t.Io(!1);break;case Pt:t.ko(!1);break;case $t:t.Io(!1),t.ko(!1)}}static ho(t){return/^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(t||"")||""===t}static bo(t){return t===Et||t===$t}static mo(t){return t===Pt||t===$t}};function ea(t){return` `}var ia=class t{rt;ct;Co;Eo;Po;$o="Saving...";To=Ut;No;Ao;Mo;constructor(t){switch(this.rt=t,this.rt.text.actionMessage=t.text.actionMessage.substring(0,90),this.rt.text.acceptButton=t.text.acceptButton.substring(0,16),this.rt.text.cancelButton=t.text.cancelButton.substring(0,16),this.ct=null,this.Co=null,this.Eo=!1,t.type){case Ct:this.Mo=this.rt.text.negativeUpdateButton?.substring(0,16),this.Ao=this.rt.text.positiveUpdateButton?.substring(0,16),this.No=this.rt.text.updateMessage?.substring(0,90),this.Po=t.categories,this.To=this.rt.text.positiveUpdateButton??Ut;break;case Et:case Pt:case $t:this.To=this.rt.text.acceptButton??Ut}}async Rt(t){if(null===this.ct){const e=await Ke();this.ct=e,this.Lt.className.includes(yi)&&me(`#${Ai}`);const i=t&&this.Po?this.Ao:this.rt.text.acceptButton,n=t&&this.Po?this.Mo:this.rt.text.cancelButton,s=function(t){const{icon:e,messageText:i,positiveButtonText:n,negativeButtonText:s}=t,a=e===Ci?"data:image/svg+xml,%3Csvg fill='none' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg clip-path='url(%23clip0)'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M33.232 28.434a2.5 2.5 0 001.768.733 1.667 1.667 0 010 3.333H5a1.667 1.667 0 110-3.333 2.5 2.5 0 002.5-2.5v-8.104A13.262 13.262 0 0118.333 5.122V1.667a1.666 1.666 0 113.334 0v3.455A13.262 13.262 0 0132.5 18.563v8.104a2.5 2.5 0 00.732 1.767zM16.273 35h7.454a.413.413 0 01.413.37 4.167 4.167 0 11-8.28 0 .417.417 0 01.413-.37z' fill='%23BDC4CB'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0'%3E%3Cpath fill='%23fff' d='M0 0h40v40H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E":e,o=e===Ci?Ci:"",r=document.createElement("div"),c=document.createElement("div"),l=document.createElement("div"),u=document.createElement("div"),d=document.createElement("div"),h=document.createElement("div"),g=document.createElement("button"),p=document.createElement("button"),f=document.createElement("div"),w=document.createElement("div"),_=document.createElement("img");return Se(c,"slidedown-body"),Se(u,"slidedown-body-icon"),Se(l,"slidedown-body-message"),Se(h,"slidedown-footer"),Se(f,Ei),Se(w,Ei),Se(g,Li),Se(g,"primary"),Se(g,Fi),Se(p,Li),Se(p,"secondary"),Se(p,Fi),r.id="normal-slidedown",c.id=$i,d.id=Di,g.id=Pi,p.id=Ni,h.id=Ui,o&&Se(_,o),_.setAttribute("alt","notification icon"),_.setAttribute("src",a||""),l.innerText=i||"",g.innerText=n||"",p.innerText=s||"",u.appendChild(_),c.appendChild(u),c.appendChild(l),c.appendChild(f),c.appendChild(d),h.appendChild(g),h.appendChild(p),h.appendChild(w),r.appendChild(c),r.appendChild(h),r}({messageText:t&&this.Po?this.No:this.rt.text.actionMessage,icon:this.rt.icon||this.Uo(),positiveButtonText:i,negativeButtonText:n}),a=document.createElement("div"),o=document.createElement("div");a.id=Ai,Se(a,yi),Se(a,vi),ye("body").appendChild(a),o.id=Mi,Se(o,Si),o.appendChild(s),this.Lt.appendChild(o),Se(this.Lt,v()?Ii:ki),this.Do.addEventListener("click",this.Lo.bind(this)),this.Fo.addEventListener("click",this.Ro.bind(this))}}static Wo(t){Re.$(t)}Lo(e){t.Wo(t.EVENTS.ALLOW_CLICK)}Ro(e){t.Wo(t.EVENTS.CANCEL_CLICK),this.In(),t.Wo(t.EVENTS.CLOSED)}In(){Se(this.Lt,xi),De(this.vt,"animationend",(t,e)=>{t.target!==this.vt||"slideDownExit"!==t.animationName&&"slideUpExit"!==t.animationName||(me(`#${Ai}`),e())},!0)}Bo(){this.Do.disabled=!0,this.Do.textContent=null,this.Do.insertAdjacentElement("beforeend",this.jo(this.$o)),this.Do.insertAdjacentElement("beforeend",this.zo()),be(this.Ko,"beforeend",ea("#FFFFFF")),Se(this.Do,"disabled"),Se(this.Do,Oi)}Vo(){this.Do.textContent=this.Ao??"",me(`#${mi}`),this.Do.disabled=!1,ve(this.Do,"disabled"),ve(this.Do,Oi)}qo(){this.Do.textContent=null,this.Do.insertAdjacentElement("beforeend",this.jo(this.To)),this.rt.type===Ct&&(this.Do.insertAdjacentElement("beforeend",this.zo()),be(this.Ko,"beforeend",function(t="#FFFFFF"){return``}()),Se(this.Do,"onesignal-error-state-button")),this.Eo=!0}Ho(t){switch(t){case 0:ta.Io(!0);break;case 1:ta.ko(!0);break;case 2:ta.Io(!0),ta.ko(!0)}}Jo(){me("#onesignal-button-indicator-holder"),ve(this.Do,"onesignal-error-state-button"),Tn(this.rt.type)||ta.xo(this.rt.type),this.Eo=!1}Uo(){return Fe(this.ct)}zo(){const t=document.createElement("div");return t.id=Ti,Se(t,mi),t}jo(t){const e=document.createElement("span");return e.textContent=t,e}get Lt(){return ye(`#${Ai}`)}get vt(){return ye(`#${Mi}`)}get Do(){return ye(`#${Pi}`)}get Fo(){return ye(`#${Ni}`)}get Ko(){return ye(`#${Ti}`)}get Go(){return ye(`#${Ui}`)}static get EVENTS(){return{ALLOW_CLICK:"slidedownAllowClick",CANCEL_CLICK:"slidedownCancelClick",SHOWN:"slidedownShown",CLOSED:"slidedownClosed",QUEUED:"slidedownQueued"}}},na=class{Yo;M;Qo;constructor(t){this.Yo=!1,this.M=t,this.Qo=!1}Zo(){const t=k();return I()===g&&t>=63&&(S()||v())||x()}Ci(){const t=OneSignal.config?.userConfig.promptOptions,e=this.Zo(),i=this.Xo(t,kt),n=this.tr(i),s=i.enabled&&n,a=e&&s;if(s&&!a)return void this.er(kt,i.timeDelay||0);const o=!!$n(t?.slidedown?.prompts,xt);a&&!o&&this.er(xt,i.timeDelay||0);const r=t?.slidedown?.prompts;if(r&&r?.length>0)for(let c=0;c0&&await ut(1e3*e),t){case kt:await this.ir();break;case xt:await this.nr(i);break;case Ct:await this.sr(i);break;case Et:await this.ar(i);break;case Pt:await this.rr(i);break;case $t:await this.cr(i);break;default:ht.S("Invalid Delayed Prompt type")}else ht.S("timeDelay not a number")}async ir(){if(Ue("internalShowNativePrompt"),this.Yo)return ht.p("Autoprompt already showing"),!1;this.Yo=!0;const t=await Ln();return this.Yo=!1,Ne(0),t}async nr(t={force:!1}){Ue("internalShowSlidedownPrompt"),t.slidedownPromptOptions||(t.slidedownPromptOptions=Rt),0===await this.M.Wt.R()?(this.Qo||this.lr(),await this.M.dr.ur(t)):ht.p("Slidedown styles failed to load")}async sr(t){Ue("internalShowCategorySlidedown"),await this.hr(Ct,t)}async ar(t){Ue("internalShowSmsSlidedown"),await this.hr(Et,t)}async rr(t){Ue("internalShowEmailSlidedown"),await this.hr(Pt,t)}async cr(t){Ue("internalShowSmsAndEmailSlidedown"),await this.hr($t,t)}async hr(t,e){const i=this.M._i.userConfig.promptOptions?.slidedown?.prompts,n=e?.slidedownPromptOptions||$n(i,t);if(!n){if(t!==xt)return void ht.S(`Slidedown type '${t}' not configured`);ht.m("Push slidedown shown with default text")}await this.nr({...e,slidedownPromptOptions:n})}lr(){this.Qo=!0,OneSignal.P.on(ia.EVENTS.SHOWN,()=>{this.M.dr.gr(!0)}),OneSignal.P.on(ia.EVENTS.CLOSED,()=>{this.M.dr.gr(!1),this.M.dr.pr()}),OneSignal.P.on(ia.EVENTS.ALLOW_CLICK,async()=>{await this.M.dr.wr(),Re.$(OneSignal.EVENTS.TEST_FINISHED_ALLOW_CLICK_HANDLING)}),OneSignal.P.on(ia.EVENTS.CANCEL_CLICK,()=>{if(this.M.dr._r)switch(this.M.dr._r?.rt.type){case xt:case Ct:ht.p("Marking slidedown dismissed"),Ne(0);break;default:ht.p("Marking slidedown dismissed"),Ne(1)}})}tr(t){return!(!t||void 0===t.pageViews)&&!(!t.autoPrompt||!t.enabled)&&le()>=t.pageViews}Xo(t,e){const i={enabled:!1,autoPrompt:!1,timeDelay:Tt.timeDelay,pageViews:Tt.pageViews};if(!t||!t.native||!t.slidedown)return i;switch(e){case kt:{const e=t.native;return{enabled:e?.enabled,autoPrompt:e?.autoPrompt,timeDelay:e?.timeDelay,pageViews:e?.pageViews}}case xt:case Ct:case Pt:case Et:case $t:{const{userConfig:t}=this.M._i,i=$n(t.promptOptions?.slidedown?.prompts||[],e);return{enabled:!!i,autoPrompt:!!i?.autoPrompt,timeDelay:i?.delay?.timeDelay,pageViews:i?.delay?.pageViews}}default:return i}}};function sa(t,e){t.forEach(t=>{t.checked=e})}function aa(t){return 0===Object.keys(t).length}var oa=class t{ot;constructor(t){this.ot=t}H(){const e=document.createElement("div"),i=document.createElement("p");i.innerText=this.ot,e.appendChild(i);const n=document.createElement("div"),s=document.createElement("div");n.id=Ai,e.id="onesignal-toast-text",Se(e,"onesignal-toast-text"),Se(n,yi),Se(n,vi),ye("body").appendChild(n),s.id=Mi,Se(s,Si),s.appendChild(e),this.Lt.appendChild(s),Se(this.Lt,v()?Ii:ki),t.Wo(t.EVENTS.SHOWN)}static Wo(t){Re.$(t)}In(){Se(this.Lt,xi),De(this.vt,"animationend",(t,e)=>{t.target!==this.vt||"slideDownExit"!==t.animationName&&"slideUpExit"!==t.animationName||(me(`#${Ai}`),e())},!0)}get Lt(){return ye(`#${Ai}`)}get vt(){return ye(`#${Mi}`)}static get EVENTS(){return{SHOWN:"toastShown",CLOSED:"toastClosed"}}},ra=class{_o(t,e){const i=this.so(t,e);ye(`#${$i}`).appendChild(i),this.br&&this.br.addEventListener("change",this.mr.bind(this));const n=ye(`#${Pi}`);n.disabled=!1,ve(n,"disabled"),me(`#${Di}`)}B(){const t=ye(`#${Di}`),e=ye(`#${Pi}`),i=document.createElement("div");Se(t,"onesignal-loading-container"),Se(i,"onesignal-loading-message"),Se(e,"disabled"),be(t,"beforeend",ea("#95A1AC")),i.innerText="Fetching your preferences",t.appendChild(i),e.disabled=!0}so(t,e){const i=function(t,e){if(!e)return t;if(aa(e)){const e=structuredClone(t);return sa(e,!0),e}return structuredClone(t).map(t=>{const i=e[t.tag];var n;return t.checked=void 0===(n=i)||n,t})}(t,e),n=i.filter(t=>i.indexOf(t)%2==0),s=i.filter(t=>i.indexOf(t)%2),a=document.createElement("div"),o=document.createElement("div"),r=document.createElement("div");return Se(a,Wi),Se(o,Wi),Se(r,Ri),r.id="tagging-container",n.forEach(t=>{a.appendChild(this.yr(t))}),s.forEach(t=>{o.appendChild(this.yr(t))}),r.appendChild(a),r.appendChild(o),r}yr(t){const{label:e}=t,i=document.createElement("label"),n=document.createElement("span"),s=document.createElement("input"),a=document.createElement("span"),o=document.createElement("div"),r=document.createElement("div");return Se(i,"onesignal-category-label"),Se(n,"onesignal-category-label-text"),Se(s,"onesignal-category-label-input"),Se(a,"onesignal-checkmark"),i.title=e,n.innerText=e,s.type="checkbox",s.value=t.tag,s.checked=!!t.checked,i.appendChild(n),i.appendChild(s),i.appendChild(a),o.setAttribute("style","clear:both"),r.appendChild(i),r.appendChild(o),r}get br(){return ye(`#${$i} > div.${Ri}`)}mr(t){const e=t.target;if(e&&"checkbox"===e.getAttribute("type")){const t=e.checked;e.setAttribute("checked",t.toString())}}static Sr(){const t=`#${$i} > div.${Ri}> div > div > label > input[type=checkbox]`,e=document.querySelectorAll(t),i={};return e.forEach(t=>{i[t.value]=t.checked}),i}},ca=class{M;vr;Or;_r;constructor(t){this.M=t,this.vr=[],this.Or=!1}async Ir(t){const e="denied"===await OneSignal.M.A.N();let i;const{subscribed:n,optedOut:s}=await OneSignal.M.gt.Na(),a=t.slidedownPromptOptions?.type;let o=!1;if(a&&(o=Tn(a)),o){if(n)return!!t.isInUpdateMode||(ht._(new Error("Already subscribed")),!1);if(i=Ae(0),s)throw new Error("User is opted out");if(e)return ht._(tt),!1}else{if(!t.force){const t=OneSignal.ye.Is(),e=OneSignal.ye.Os(),i=t&&e;if(t&&a===Et)return ht._(nt(Et)),!1;if(e&&a===Pt)return ht._(nt(Pt)),!1;if(i&&a===$t)return ht._(nt($t)),!1}i=Ae(1)}return!(i&&!t.force&&!t.isInUpdateMode&&(ht._(new Error(`${a||"unknown"} previously dismissed`)),1))}kr(){if(!this._r)throw la;const t=ra.Sr();this.M.mi.Cr(t),Ln(),this.M.mi.bi(!0)}Er(){if(!this._r)throw la;const t=this._r.Co?.eo,e=this._r.Co?.yo();if(!t||e)throw new Q(1);const i=this._r.Co?.So();this.Pr(i)}$r(){if(!this._r)throw la;const t=this._r.Co?.Xa,e=this._r.Co?.vo();if(!t||e)throw new Q(0);const i=this._r.Co?.Oo();this.Tr(i)}Nr(){if(!this._r)throw la;const t=this._r.Co?.Xa,e=this._r.Co?.eo,i=this._r.Co?.yo(),n=this._r.Co?.vo();if(!t&&!e||i&&n)throw new Q(2);const s=this._r.Co?.So(),a=this._r.Co?.Oo();if(!e)throw new Q(1);if(i||this.Pr(s),!t)throw new Q(0);n||this.Tr(a)}Pr(t){t&&OneSignal.User.addEmail(t)}Tr(t){t&&OneSignal.User.addSms(t)}async Ar(){if(!this._r)throw la;const t=this._r.rt.text.confirmMessage;if(!t)return;await ut(1e3);const e=new oa(t);e.H(),await ut(5e3),e.In(),oa.Wo(oa.EVENTS.CLOSED)}Mr(t){switch(t.slidedownPromptOptions?.type){case Ct:this.Ur(t);break;case Pt:case Et:case $t:this.Dr(t)}}Ur(t){Ue("mountTaggingContainer");try{let e={};const i=new ra,n=t.slidedownPromptOptions?.categories;if(!n)throw new Error("Categories not defined");const s=OneSignal.ye.Ze().ni;t.isInUpdateMode&&s?(this.M.mi.Lr(s),e=function(t){const e={};return Object.keys(t).forEach(i=>{e[i]="1"===t[i]}),e}(s)):sa(n,!0),i._o(n,e)}catch(e){ht.S("Failed to create tagging container",e)}}Dr(t){Ue("mountChannelCaptureContainer");try{if(t.slidedownPromptOptions){const e=new ta(t.slidedownPromptOptions);e._o(),this._r&&(this._r.Co=e)}}catch(e){ht.S("Failed to create channel capture container",e)}}async wr(){if(!this._r)throw la;const t=this._r.rt.type;this._r.Eo&&this._r.Jo();try{switch(t){case xt:Ln();break;case Ct:this.kr();break;case Pt:this.Er();break;case Et:this.$r();break;case $t:this.Nr()}}catch(e){return ht.m("Slidedown failed to update:",e),this._r.Vo(),this._r.qo(),void(e instanceof Q&&this._r.Ho(e.reason))}switch(this._r&&(this._r.In(),Tn(t)||await this.Ar(),await ut(1e3),ia.Wo(ia.EVENTS.CLOSED)),t){case xt:case Ct:ht.p("Marking slidedown dismissed"),Ne(0);break;default:ht.p("Marking slidedown dismissed"),Ne(1)}}gr(t){this.Or=t}async pr(){if(this.vr.length>0){const t=this.Fr();t&&await this.ur(t)}}di(t){this.vr.push(t),ia.Wo(ia.EVENTS.QUEUED)}Fr(){return this.vr.shift()}async ur(t){if(Ue("createSlidedown"),!ge()){try{if(!(await this.Ir(t)))return}catch(e){return void ht.m("Slidedown check error",e)}if(function(){const t=OneSignal.yi;t?.rt?.enable&&(t.Ft.J(),OneSignal.P.once(ia.EVENTS.CLOSED,()=>{t.Ft.H()}))}(),this.Or)this.di(t);else try{this.gr(!0);const e=t.slidedownPromptOptions||Rt;this._r=new ia(e),await this._r.Rt(t.isInUpdateMode),this.Mr(t),ht.p("Showing Slidedown"),ia.Wo(ia.EVENTS.SHOWN)}catch(e){ht.S("Error showing Slidedown:",e),this.gr(!1),this._r?.In()}}}},la=new Error("Slidedown is missing"),ua=class{Rr={};M;Wr={};constructor(t){this.M=t}bi(){ht._("Local tags:",this.Rr);const t=function(t,e){const i={};return Object.keys(t).forEach(n=>{e[n]!==t[n]&&(i[n]=t[n])}),i}(function(t){const e={};return Object.keys(t).forEach(i=>{e[i]=!0===t[i]?"1":"0"}),e}(this.Rr),this.Wr);return aa(t)?(ht.m("No tag change detected"),t):(OneSignal.User.addTags(t),t)}Cr(t){this.Rr=t}Lr(t){this.M.mi.Wr=t}},da=class{_i;Wt;gt;D;_a;A;Mi;Ei;Ni;mi;dr;constructor(t){var e;this._i=t,this.gt=new Ys(this,{safariWebId:(e=this._i).safariWebId,appId:e.appId,vapidPublicKey:e.vapidPublicKey,onesignalVapidPublicKey:e.onesignalVapidPublicKey}),this.D=function(t){const e=t._i,i={workerPath:new zs(It),registrationOptions:Ot};return e.userConfig&&(e.userConfig.path&&(i.workerPath=new zs(`${e.userConfig.path.replace(/\/+$/,"")}/${(e.userConfig.serviceWorkerPath??"").replace(/^\/+/,"")}`)),e.userConfig.serviceWorkerParam&&(i.registrationOptions=e.userConfig.serviceWorkerParam)),new Ks(t,i)}(this),this.A=new Qs,this._a=new Us(this),this.Mi=new Xs(this),this.Ni=new Zs(this),this.mi=new ua(this),this.dr=new ca(this),this.Ei=new na(this),this.Wt=new He}},ha=class{setLogLevel(t){ht.u(t)}},ga=class extends un{be;Br;constructor(t){super(),this.Br=t,this.be="granted"===t,"undefined"!=typeof OneSignal&&OneSignal.P.on(OneSignal.EVENTS.NOTIFICATION_PERMISSION_CHANGED_AS_STRING,t=>{this.Br=t,this.be="granted"===t})}get permissionNative(){return this.Br}get permission(){return this.be}async setDefaultUrl(t){if(Ue("setDefaultUrl",t),void 0===t)throw st("url");if("string"!=typeof t)throw ot("url");if(!ct(t,{allowNull:!0}))throw at("url");await Me(),Ue("setDefaultNotificationUrl",t);const e=await de();e.defaultNotificationUrl=t,await he(e)}async setDefaultTitle(t){if(Ue("setDefaultTitle",t),void 0===t)throw st("title");if("string"!=typeof t)throw ot("title");await Me();const e=await de();e.defaultNotificationTitle=t,await he(e)}isPushSupported(){return Ue("isPushNotificationsSupported"),!0}async requestPermission(){return!ge()&&(await Me(),await OneSignal.M.Ei.ir())}addEventListener(t,e){OneSignal.P.on(t,e)}removeEventListener(t,e){OneSignal.P.off(t,e)}},pa={NOTIFICATION_PERMISSION_CHANGED_AS_STRING:"permissionChangeAsString",NOTIFICATION_PERMISSION_CHANGED_AS_BOOLEAN:"permissionChange",SUBSCRIPTION_CHANGED:"change",WELCOME_NOTIFICATION_SENT:"sendWelcomeNotification",NOTIFICATION_WILL_DISPLAY:"foregroundWillDisplay",NOTIFICATION_DISMISSED:"dismiss",NOTIFICATION_CLICKED:"click",SDK_INITIALIZED:"initializeInternal",SDK_INITIALIZED_PUBLIC:"initialize",REGISTERED:"register",PERMISSION_PROMPT_DISPLAYED:"permissionPromptDisplay",TEST_FINISHED_ALLOW_CLICK_HANDLING:"testFinishedAllowClickHandling",SESSION_STARTED:"os.sessionStarted"},fa=class{async sendOutcome(t,e){const i=OneSignal.config?.userConfig.outcomes;if(!i)return void ht.S(`No outcomes config for ${t}`);const n=new Ds(OneSignal.config.appId,i,t,!1);if(void 0!==e&&"number"!=typeof e)return void ht.S("Outcome weight must be a number");if(!(await n.Xs()))return;const s=await n.Zs();await n.aa({type:s.type,notificationIds:s.notificationIds,weight:e})}async sendUniqueOutcome(t){const e=OneSignal.config?.userConfig.outcomes;if(!e)return void ht.S(`No outcomes config for ${t}`);const i=new Ds(OneSignal.config.appId,e,t,!0);if(!(await i.Xs()))return;const n=await i.Zs();if(4===n.type)return void ht.m("Upgrade required for this feature");const{notificationIds:s}=n,a=await i.ea(s);i.ia(n,a)?await i.aa({type:n.type,notificationIds:a}):ht.m(`'${t}' already reported`)}},wa=class extends un{constructor(){super()}async promptPush(t){ge()||(await Me(),await OneSignal.M.Ei.hr(xt,t))}async promptPushCategories(t){if(ge())return;await Me();const e=await OneSignal.M.gt.ht();await OneSignal.M.Ei.sr({...t,isInUpdateMode:e})}async promptSms(t){ge()||(await Me(),await OneSignal.M.Ei.ar({...t}))}async promptEmail(t){ge()||(await Me(),await OneSignal.M.Ei.rr({...t}))}async promptSmsAndEmail(t){ge()||(await Me(),await OneSignal.M.Ei.cr({...t}))}addEventListener(t,e){OneSignal.P.on(t,e)}removeEventListener(t,e){OneSignal.P.off(t,e)}},_a=class t{static EVENTS=pa;static O=!1;static async jr(){const e=new Es;await e.bs(),t.ye=new $s(e);const i=await fe(),n=await t.M.A.N();t.User=new En(!0,i,n),this.Notifications=new ga(n)}static async zr(e){const i=await qt(e);ht.p("Final web app config:",i),t.config=i,t.M=new da(i),t.config=t.M._i}static async login(t,e){if(Ue("login",{externalId:t,jwtToken:e}),!ge()){if(void 0===t)throw st("externalId");if("string"!=typeof t)throw ot("externalId");if(void 0!==e&&"string"!=typeof e)throw ot("jwtToken");await Ts.login(t,e)}}static async logout(){Ue("logout"),ge()||await Ts.logout()}static async init(e){if(Ue("init"),ht.p(`Browser Environment: ${I()} ${k()}`),localStorage.removeItem("isOptedOut"),localStorage.removeItem("isPushNotificationsEnabled"),function(){if(OneSignal.Kr)throw new Error("SDK already initialized");OneSignal.Kr=!0}(),await t.zr(e),!t.config)throw new Error("OneSignal config not initialized!");I()!==f||t.config.safariWebId?await Yt.catch(t=>{ht.S("IndexedDB unavailable, close & reopen the page to retry init",t)})&&(await t.jr(),t.O=await(async()=>{const t=function(){const t=localStorage.getItem(oe);return null===t?null:"true"===t}();if(null!==t)return t;const e=await ee("userConsent")??!1;return ce(e),e})(),!re()||t.O?await t.Vr():t.qr=!0):ht.m(it)}static async Vr(){async function e(){t.Hr||(t.Hr=!0,t.P.on(t.EVENTS.NOTIFICATION_PERMISSION_CHANGED_AS_STRING,Nn),t.P.on(t.EVENTS.SUBSCRIPTION_CHANGED,An),t.P.on(t.EVENTS.SDK_INITIALIZED,Fn),window.addEventListener("focus",()=>{!async function(){const t=await ee("notificationPermission"),e=await OneSignal.M.A.N();t!==e&&(await Be(),await te.put("Options",{key:"notificationPermission",value:e}))}()}),await async function(t){const e=Ve(),i=OneSignal.config,n=await ie("appId");if(n&&n!==e){if(ht._(`App ID changed ${n} -> ${e}, clearing state`),await te.put("Options",{key:"isPushEnabled",value:null}),await te.put("Options",{key:"lastPushId",value:null}),await te.put("Options",{key:"lastPushToken",value:null}),await te.put("Options",{key:"lastOptedIn",value:null}),Zt)return;await te.put("Ids",{type:"registrationId",id:null}),await te.put("Ids",{type:"userId",id:null}),OneSignal.ye.ui.Wn(2)}await te.put("Ids",{type:"appId",id:e});const s=t||i.siteName||document.title||"Notification";await te.put("Options",{key:"pageTitle",value:s}),ht._(`Set pageTitle to be '${s}'.`)}(),await async function(){const t=[],e=OneSignal.config?.userConfig.persistNotification;t.push(te.put("Options",{key:"persistNotification",value:null==e||e}));const i=OneSignal.config?.userConfig.webhooks;return["notification.willDisplay","notification.clicked","notification.dismissed"].forEach(e=>{i&&i[e]?t.push(te.put("Options",{key:`webhooks.${e}`,value:i[e]})):t.push(te.put("Options",{key:`webhooks.${e}`,value:!1}))}),i&&i.cors?t.push(te.put("Options",{key:"webhooks.cors",value:!0})):t.push(te.put("Options",{key:"webhooks.cors",value:!1})),OneSignal.config?.userConfig.notificationClickHandlerMatch?t.push(te.put("Options",{key:"notificationClickHandlerMatch",value:OneSignal.config.userConfig.notificationClickHandlerMatch})):t.push(te.put("Options",{key:"notificationClickHandlerMatch",value:"exact"})),OneSignal.config?.userConfig.notificationClickHandlerAction?t.push(te.put("Options",{key:"notificationClickHandlerAction",value:OneSignal.config.userConfig.notificationClickHandlerAction})):t.push(te.put("Options",{key:"notificationClickHandlerAction",value:"navigate"})),Promise.all(t)}(),await async function(){ht.p("internalInit()"),await OneSignal.M.D.Sa();const t=OneSignal.M.Ni;OneSignal.P.on(OneSignal.EVENTS.SESSION_STARTED,t.Za.bind(t)),cn(),"visible"===document.visibilityState?await Dn():De(document,"visibilitychange",(t,e)=>{"visible"===document.visibilityState&&(e(),Dn())},!0)}())}t.qr=!1,t.M._a.Ks(),"complete"===document.readyState||"interactive"===document.readyState?await e():(window.addEventListener("DOMContentLoaded",()=>{e()}),document.onreadystatechange=()=>{"complete"!==document.readyState&&"interactive"!==document.readyState||e()})}static async setConsentGiven(e){if(Ue("setConsentGiven",{consent:e}),void 0===e)throw st("consent");if("boolean"!=typeof e)throw ot("consent");t.O=e,ce(e),e&&t.qr&&await t.Vr()}static async setConsentRequired(t){if(Ue("setConsentRequired",{requiresConsent:t}),void 0===t)throw st("requiresConsent");if("boolean"!=typeof t)throw ot("requiresConsent");var e;e=t,localStorage.setItem(ae,e.toString())}static push(e){return function(t,e){if("function"==typeof e)return e(t);throw new Error("Callback is not a function")}(t,e)}static bt;static config=null;static Oi=!1;static v=!1;static C=!1;static wo=!1;static yi=null;static qr=!0;static P=new dn;static L={};static Kr=!1;static Hr=!1;static M;static ye;static Notifications=new ga;static Slidedown=new wa;static Session=new fa;static User=new En(!1);static Debug=new ha};ht._(`Web SDK loaded (version ${C}, ${T} environment).`),ht.p(`Current Page URL: ${"undefined"==typeof location?"NodeJS":location.href}`),function(){if(window.__oneSignalSdkLoadCount=Le()+1,Le()>1)return ht.m("SDK included more than once"),void ht.p(`Skipping duplicate init (${Le()})`);window.OneSignal=_a,window.OneSignalDeferred=window.OneSignalDeferred??[];const t=async function(t){for(const i of t)try{await _a.push(i)}catch(e){ht.S(e)}}(window.OneSignalDeferred);Object.defineProperty(window.OneSignalDeferred,"push",{value:async function(e){return await t,_a.push(e)}})}()}(); //# sourceMappingURL=OneSignalSDK.page.es6.js.map